diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-30 13:30:19 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-30 13:30:19 +0400 |
commit | 915dab01a9aefd59497ea97e76b45db3a865635f (patch) | |
tree | 502f003d19dc8bb025827e7f8fbe050e045af702 /src/Network/BitTorrent/Tracker/RPC/UDP.hs | |
parent | 5573c240b4c2e87cf2deb55939591edd0851f8b8 (diff) |
Rename scrape datatypes
Diffstat (limited to 'src/Network/BitTorrent/Tracker/RPC/UDP.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker/RPC/UDP.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/UDP.hs b/src/Network/BitTorrent/Tracker/RPC/UDP.hs index 0336db8d..bb5fe7e3 100644 --- a/src/Network/BitTorrent/Tracker/RPC/UDP.hs +++ b/src/Network/BitTorrent/Tracker/RPC/UDP.hs | |||
@@ -30,7 +30,6 @@ import Control.Monad | |||
30 | import Data.ByteString (ByteString) | 30 | import Data.ByteString (ByteString) |
31 | import Data.IORef | 31 | import Data.IORef |
32 | import Data.List as L | 32 | import Data.List as L |
33 | import Data.Map as M | ||
34 | import Data.Maybe | 33 | import Data.Maybe |
35 | import Data.Monoid | 34 | import Data.Monoid |
36 | import Data.Serialize | 35 | import Data.Serialize |
@@ -94,7 +93,7 @@ data Request = Connect | |||
94 | 93 | ||
95 | data Response = Connected ConnectionId | 94 | data Response = Connected ConnectionId |
96 | | Announced AnnounceInfo | 95 | | Announced AnnounceInfo |
97 | | Scraped [ScrapeInfo] | 96 | | Scraped [ScrapeEntry] |
98 | | Failed Text | 97 | | Failed Text |
99 | deriving Show | 98 | deriving Show |
100 | 99 | ||
@@ -288,7 +287,7 @@ connectUDP tracker = do | |||
288 | case resp of | 287 | case resp of |
289 | Connected cid -> return cid | 288 | Connected cid -> return cid |
290 | Failed msg -> throwIO $ userError $ T.unpack msg | 289 | Failed msg -> throwIO $ userError $ T.unpack msg |
291 | _ -> throwIO $ userError "message type mismatch" | 290 | _ -> throwIO $ userError "connect: response type mismatch" |
292 | 291 | ||
293 | connect :: URI -> IO UDPTracker | 292 | connect :: URI -> IO UDPTracker |
294 | connect uri = do | 293 | connect uri = do |
@@ -313,12 +312,12 @@ announce ann tracker = do | |||
313 | Announced info -> return info | 312 | Announced info -> return info |
314 | _ -> fail "announce: response type mismatch" | 313 | _ -> fail "announce: response type mismatch" |
315 | 314 | ||
316 | scrape :: ScrapeQuery -> UDPTracker -> IO Scrape | 315 | scrape :: ScrapeQuery -> UDPTracker -> IO ScrapeInfo |
317 | scrape ihs tracker = do | 316 | scrape ihs tracker = do |
318 | freshConnection tracker | 317 | freshConnection tracker |
319 | resp <- transaction tracker (Scrape ihs) | 318 | resp <- transaction tracker (Scrape ihs) |
320 | case resp of | 319 | case resp of |
321 | Scraped info -> return $ M.fromList $ L.zip ihs info | 320 | Scraped info -> return $ L.zip ihs info |
322 | _ -> fail "scrape: response type mismatch" | 321 | _ -> fail "scrape: response type mismatch" |
323 | 322 | ||
324 | {----------------------------------------------------------------------- | 323 | {----------------------------------------------------------------------- |