summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-07 21:49:10 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-07 21:49:10 +0400
commit9356528a6a14e35448d5b8556bc951b8eefeef1e (patch)
treeea47c1ddf3148ac5eb26e874fcae3284c96c2f9a /src/Network
parent2940d8497947ebf18a70343b4a787a5e28c85754 (diff)
~ Merge Encoding to Main.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Tracker.hs10
1 files changed, 7 insertions, 3 deletions
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) {
112 , reqEvent = Nothing 112 , reqEvent = Nothing
113 } 113 }
114 114
115-- | Must be sent to the tracker if the client is shutting down gracefully. 115-- | Must be sent to the tracker if the client is shutting down
116-- gracefully.
116-- 117--
117stoppedReq :: TConnection -> Progress -> TRequest 118stoppedReq :: TConnection -> Progress -> TRequest
118stoppedReq ses pr = (genericReq ses pr) { 119stoppedReq ses pr = (genericReq ses pr) {
@@ -122,7 +123,8 @@ stoppedReq ses pr = (genericReq ses pr) {
122 } 123 }
123 124
124-- | Must be sent to the tracker when the download completes. 125-- | Must be sent to the tracker when the download completes.
125-- However, must not be sent if the download was already 100% complete. 126-- However, must not be sent if the download was already 100%
127-- complete.
126-- 128--
127completedReq :: TConnection -> Progress -> TRequest 129completedReq :: TConnection -> Progress -> TRequest
128completedReq ses pr = (genericReq ses pr) { 130completedReq ses pr = (genericReq ses pr) {
@@ -141,7 +143,9 @@ data TSession = TSession {
141 } 143 }
142 144
143newSession :: Progress -> Int -> [PeerAddr] -> IO TSession 145newSession :: Progress -> Int -> [PeerAddr] -> IO TSession
144newSession pr i ps = TSession <$> newTVarIO pr <*> newIORef i <*> newTVarIO ps 146newSession pr i ps = TSession <$> newTVarIO pr
147 <*> newIORef i
148 <*> newTVarIO psx
145 149
146getPeerList :: TSession -> IO [PeerAddr] 150getPeerList :: TSession -> IO [PeerAddr]
147getPeerList = readTVarIO . sePeers 151getPeerList = readTVarIO . sePeers