From 9356528a6a14e35448d5b8556bc951b8eefeef1e Mon Sep 17 00:00:00 2001 From: Sam T Date: Fri, 7 Jun 2013 21:49:10 +0400 Subject: ~ Merge Encoding to Main. --- src/Network/BitTorrent/Tracker.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Network/BitTorrent') diff --git a/src/Network/BitTorrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs index 2319a551..2e599002 100644 --- a/src/Network/BitTorrent/Tracker.hs +++ b/src/Network/BitTorrent/Tracker.hs @@ -112,7 +112,8 @@ regularReq numWant ses pr = (genericReq ses pr) { , reqEvent = Nothing } --- | Must be sent to the tracker if the client is shutting down gracefully. +-- | Must be sent to the tracker if the client is shutting down +-- gracefully. -- stoppedReq :: TConnection -> Progress -> TRequest stoppedReq ses pr = (genericReq ses pr) { @@ -122,7 +123,8 @@ stoppedReq ses pr = (genericReq ses pr) { } -- | Must be sent to the tracker when the download completes. --- However, must not be sent if the download was already 100% complete. +-- However, must not be sent if the download was already 100% +-- complete. -- completedReq :: TConnection -> Progress -> TRequest completedReq ses pr = (genericReq ses pr) { @@ -141,7 +143,9 @@ data TSession = TSession { } newSession :: Progress -> Int -> [PeerAddr] -> IO TSession -newSession pr i ps = TSession <$> newTVarIO pr <*> newIORef i <*> newTVarIO ps +newSession pr i ps = TSession <$> newTVarIO pr + <*> newIORef i + <*> newTVarIO psx getPeerList :: TSession -> IO [PeerAddr] getPeerList = readTVarIO . sePeers -- cgit v1.2.3