X-Git-Url: https://git.rkrishnan.org/?p=functorrent.git;a=blobdiff_plain;f=src%2FFuncTorrent%2FTracker%2FUdp.hs;h=de99ce2721519d57f860a1ca2095e7e963822cd3;hp=ae7ad1e72b56166a80616c592c1cf05270e1d002;hb=aa5477676dd98fb07a2afa118c29f98a4885fdc9;hpb=2b7c4456d2a16f9392108b617c4147c429f1ce59 diff --git a/src/FuncTorrent/Tracker/Udp.hs b/src/FuncTorrent/Tracker/Udp.hs index ae7ad1e..de99ce2 100644 --- a/src/FuncTorrent/Tracker/Udp.hs +++ b/src/FuncTorrent/Tracker/Udp.hs @@ -96,7 +96,7 @@ instance Binary UDPRequest where putWord32be 0 putWord32be 10 putWord16be $ fromIntegral port - put (ScrapeReq _ _ _) = undefined + put ScrapeReq {} = undefined get = undefined instance Binary UDPResponse where @@ -189,7 +189,7 @@ getIPPortPairs = do ip <- toIP <$> getByteString 4 port <- toPort <$> getByteString 2 ipportpairs <- getIPPortPairs - return $ (Peer ip port) : ipportpairs + return $ Peer ip port : ipportpairs startSession :: String -> Port -> IO UDPTrackerHandle startSession host port = do @@ -198,7 +198,7 @@ startSession host port = do let (SockAddrInet p ip) = addrAddress $ head addrinfos putStrLn "connected to tracker" return UDPTrackerHandle { sock = s - , addr = (SockAddrInet (fromIntegral port) ip) } + , addr = SockAddrInet (fromIntegral port) ip } closeSession :: UDPTrackerHandle -> IO () closeSession (UDPTrackerHandle s _) = close s @@ -229,5 +229,4 @@ trackerLoop url sport peerId infohash fschan tstate = forever $ do t1 <- connectRequest cid <- connectResponse t1 t2 <- announceRequest cid infohash peerId (fromIntegral up) (fromIntegral down) (fromIntegral (left tstate)) (fromIntegral sport) - stats <- announceResponse t2 - return stats + announceResponse t2