X-Git-Url: https://git.rkrishnan.org/?p=functorrent.git;a=blobdiff_plain;f=src%2FFuncTorrent%2FTracker%2FHttp.hs;h=13395cc72dfc789940646eb3fb5c8f2aae3e6c7f;hp=9edf3fca6691149ed218f012df2a5784b826ef02;hb=272216c101f5f411726898f90355956ab9a105b7;hpb=ebda66bc8731a77d63ec63635473a717bc434885 diff --git a/src/FuncTorrent/Tracker/Http.hs b/src/FuncTorrent/Tracker/Http.hs index 9edf3fc..13395cc 100644 --- a/src/FuncTorrent/Tracker/Http.hs +++ b/src/FuncTorrent/Tracker/Http.hs @@ -42,7 +42,7 @@ import qualified FuncTorrent.FileSystem as FS (MsgChannel, Stats(..), getStats) import FuncTorrent.Network (sendGetRequest) import FuncTorrent.PeerMsgs (makePeer) import FuncTorrent.Utils (splitN, IP, Port) -import FuncTorrent.Tracker.Types(TState(..), TrackerResponse(..)) +import FuncTorrent.Tracker.Types(TState(..), HttpTrackerResponse(..)) --- | URL encode hash as per RFC1738 @@ -93,7 +93,7 @@ trackerLoop url sport peerId infohash fschan tstate = forever $ do void $ swapMVar (connectedPeers tstate) (peers tresp) threadDelay $ fromIntegral (interval tresp) -parseTrackerResponse :: BVal -> Either ByteString TrackerResponse +parseTrackerResponse :: BVal -> Either ByteString HttpTrackerResponse parseTrackerResponse resp = case lookup "failure reason" body of Just (Bstr err) -> Left err @@ -102,7 +102,7 @@ parseTrackerResponse resp = let (Just (Bint i)) = lookup "interval" body (Just (Bstr peersBS)) = lookup "peers" body pl = map makePeer (splitN 6 peersBS) - in Right TrackerResponse { + in Right HttpTrackerResponse { interval = i , peers = pl , complete = Nothing