]> git.rkrishnan.org Git - functorrent.git/blobdiff - src/FuncTorrent/Tracker/Http.hs
refactoring: return type of tracker
[functorrent.git] / src / FuncTorrent / Tracker / Http.hs
index 9edf3fca6691149ed218f012df2a5784b826ef02..13395cc72dfc789940646eb3fb5c8f2aae3e6c7f 100644 (file)
@@ -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