diff options
Diffstat (limited to 'src/Network/BitTorrent/Tracker.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Network/BitTorrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs index 25d2c358..7a43fb23 100644 --- a/src/Network/BitTorrent/Tracker.hs +++ b/src/Network/BitTorrent/Tracker.hs | |||
@@ -88,8 +88,8 @@ tconnection t = TConnection (tAnnounce t) (tInfoHash t) | |||
88 | 88 | ||
89 | 89 | ||
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 -> AnnounceQuery |
92 | genericReq ses pr = TRequest { | 92 | genericReq ses pr = AnnounceQuery { |
93 | reqInfoHash = tconnInfoHash ses | 93 | reqInfoHash = tconnInfoHash ses |
94 | , reqPeerId = tconnPeerId ses | 94 | , reqPeerId = tconnPeerId ses |
95 | , reqPort = tconnPort ses | 95 | , reqPort = tconnPort ses |
@@ -107,7 +107,7 @@ genericReq ses pr = TRequest { | |||
107 | -- | The first request to the tracker that should be created is | 107 | -- | The first request to the tracker that should be created is |
108 | -- 'startedReq'. It includes necessary 'Started' event field. | 108 | -- 'startedReq'. It includes necessary 'Started' event field. |
109 | -- | 109 | -- |
110 | startedReq :: TConnection -> Progress -> TRequest | 110 | startedReq :: TConnection -> Progress -> AnnounceQuery |
111 | startedReq ses pr = (genericReq ses pr) { | 111 | startedReq ses pr = (genericReq ses pr) { |
112 | reqIP = Nothing | 112 | reqIP = Nothing |
113 | , reqNumWant = Just defaultNumWant | 113 | , reqNumWant = Just defaultNumWant |
@@ -118,7 +118,7 @@ startedReq ses pr = (genericReq ses pr) { | |||
118 | -- notify tracker about current state of the client | 118 | -- notify tracker about current state of the client |
119 | -- so new peers could connect to the client. | 119 | -- so new peers could connect to the client. |
120 | -- | 120 | -- |
121 | regularReq :: Int -> TConnection -> Progress -> TRequest | 121 | regularReq :: Int -> TConnection -> Progress -> AnnounceQuery |
122 | regularReq numWant ses pr = (genericReq ses pr) { | 122 | regularReq numWant ses pr = (genericReq ses pr) { |
123 | reqIP = Nothing | 123 | reqIP = Nothing |
124 | , reqNumWant = Just numWant | 124 | , reqNumWant = Just numWant |
@@ -128,7 +128,7 @@ regularReq numWant ses pr = (genericReq ses pr) { | |||
128 | -- | Must be sent to the tracker if the client is shutting down | 128 | -- | Must be sent to the tracker if the client is shutting down |
129 | -- gracefully. | 129 | -- gracefully. |
130 | -- | 130 | -- |
131 | stoppedReq :: TConnection -> Progress -> TRequest | 131 | stoppedReq :: TConnection -> Progress -> AnnounceQuery |
132 | stoppedReq ses pr = (genericReq ses pr) { | 132 | stoppedReq ses pr = (genericReq ses pr) { |
133 | reqIP = Nothing | 133 | reqIP = Nothing |
134 | , reqNumWant = Nothing | 134 | , reqNumWant = Nothing |
@@ -139,7 +139,7 @@ stoppedReq ses pr = (genericReq ses pr) { | |||
139 | -- However, must not be sent if the download was already 100% | 139 | -- However, must not be sent if the download was already 100% |
140 | -- complete. | 140 | -- complete. |
141 | -- | 141 | -- |
142 | completedReq :: TConnection -> Progress -> TRequest | 142 | completedReq :: TConnection -> Progress -> AnnounceQuery |
143 | completedReq ses pr = (genericReq ses pr) { | 143 | completedReq ses pr = (genericReq ses pr) { |
144 | reqIP = Nothing | 144 | reqIP = Nothing |
145 | , reqNumWant = Nothing | 145 | , reqNumWant = Nothing |
@@ -233,7 +233,7 @@ withTracker initProgress conn action = bracket start end (action . fst) | |||
233 | resp <- tryJust isIOException $ do | 233 | resp <- tryJust isIOException $ do |
234 | askTracker (tconnAnnounce conn) (regularReq defaultNumWant conn pr) | 234 | askTracker (tconnAnnounce conn) (regularReq defaultNumWant conn pr) |
235 | case resp of | 235 | case resp of |
236 | Right (OK {..}) -> do | 236 | Right (AnnounceInfo {..}) -> do |
237 | writeIORef seInterval respInterval | 237 | writeIORef seInterval respInterval |
238 | 238 | ||
239 | -- we rely on the fact that union on lists is not | 239 | -- we rely on the fact that union on lists is not |