diff options
Diffstat (limited to 'src/Network/BitTorrent/Tracker.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs index b737a3df..25d2c358 100644 --- a/src/Network/BitTorrent/Tracker.hs +++ b/src/Network/BitTorrent/Tracker.hs | |||
@@ -90,8 +90,7 @@ tconnection t = TConnection (tAnnounce t) (tInfoHash t) | |||
90 | -- | used to avoid boilerplate; do NOT export me | 90 | -- | used to avoid boilerplate; do NOT export me |
91 | genericReq :: TConnection -> Progress -> TRequest | 91 | genericReq :: TConnection -> Progress -> TRequest |
92 | genericReq ses pr = TRequest { | 92 | genericReq ses pr = TRequest { |
93 | reqAnnounce = tconnAnnounce ses | 93 | reqInfoHash = tconnInfoHash ses |
94 | , reqInfoHash = tconnInfoHash ses | ||
95 | , reqPeerId = tconnPeerId ses | 94 | , reqPeerId = tconnPeerId ses |
96 | , reqPort = tconnPort ses | 95 | , reqPort = tconnPort ses |
97 | 96 | ||
@@ -221,7 +220,7 @@ withTracker :: Progress -> TConnection -> (TSession -> IO a) -> IO a | |||
221 | withTracker initProgress conn action = bracket start end (action . fst) | 220 | withTracker initProgress conn action = bracket start end (action . fst) |
222 | where | 221 | where |
223 | start = do | 222 | start = do |
224 | resp <- askTracker (startedReq conn initProgress) | 223 | resp <- askTracker (tconnAnnounce conn) (startedReq conn initProgress) |
225 | se <- newSession defaultChanSize initProgress | 224 | se <- newSession defaultChanSize initProgress |
226 | (respInterval resp) (respPeers resp) | 225 | (respInterval resp) (respPeers resp) |
227 | 226 | ||
@@ -232,7 +231,7 @@ withTracker initProgress conn action = bracket start end (action . fst) | |||
232 | waitInterval se | 231 | waitInterval se |
233 | pr <- getProgress se | 232 | pr <- getProgress se |
234 | resp <- tryJust isIOException $ do | 233 | resp <- tryJust isIOException $ do |
235 | askTracker (regularReq defaultNumWant conn pr) | 234 | askTracker (tconnAnnounce conn) (regularReq defaultNumWant conn pr) |
236 | case resp of | 235 | case resp of |
237 | Right (OK {..}) -> do | 236 | Right (OK {..}) -> do |
238 | writeIORef seInterval respInterval | 237 | writeIORef seInterval respInterval |
@@ -252,7 +251,7 @@ withTracker initProgress conn action = bracket start end (action . fst) | |||
252 | end (se, tid) = do | 251 | end (se, tid) = do |
253 | killThread tid | 252 | killThread tid |
254 | pr <- getProgress se | 253 | pr <- getProgress se |
255 | leaveTracker $ stoppedReq conn pr | 254 | leaveTracker (tconnAnnounce conn) (stoppedReq conn pr) |
256 | 255 | ||
257 | {----------------------------------------------------------------------- | 256 | {----------------------------------------------------------------------- |
258 | Scrape | 257 | Scrape |