From: Ramakrishnan Muthukrishnan Date: Wed, 15 Jun 2016 05:01:36 +0000 (+0530) Subject: Tracker/Udp.hs: pass a proper peer id X-Git-Url: https://git.rkrishnan.org/listings/specifications/frontends/FTP-and-SFTP.rst?a=commitdiff_plain;h=46dc8fae54b98a586eb393c639716bbf3065255d;p=functorrent.git Tracker/Udp.hs: pass a proper peer id --- diff --git a/src/FuncTorrent/Tracker/Udp.hs b/src/FuncTorrent/Tracker/Udp.hs index f2198a3..2437003 100644 --- a/src/FuncTorrent/Tracker/Udp.hs +++ b/src/FuncTorrent/Tracker/Udp.hs @@ -161,12 +161,12 @@ connectResponse tid = do return 0 _ -> return 0 -announceRequest :: Word64 -> ByteString -> Word64 -> Word64 -> Word64 -> Word16 -> ReaderT UDPTrackerHandle IO Word32 -announceRequest cid infohash up down left port = do +announceRequest :: Word64 -> ByteString -> String -> Word64 -> Word64 -> Word64 -> Word16 -> ReaderT UDPTrackerHandle IO Word32 +announceRequest cid infohash peerId up down left port = do h <- ask tidi <- liftIO randomIO -- connId transId infohash peerId down left up event port) - let pkt = encode $ AnnounceReq cid tidi infohash "foo" down left up None port + let pkt = encode $ AnnounceReq cid tidi infohash peerId down left up None port liftIO $ sendRequest h (toStrict pkt) return tidi @@ -226,6 +226,6 @@ trackerLoop url sport peerId infohash fschan tstate = do t1 <- connectRequest cid <- connectResponse t1 liftIO $ print cid - t2 <- announceRequest cid infohash (fromIntegral up) (fromIntegral down) (fromIntegral (left tstate)) (fromIntegral sport) + t2 <- announceRequest cid infohash peerId (fromIntegral up) (fromIntegral down) (fromIntegral (left tstate)) (fromIntegral sport) stats <- announceResponse t2 liftIO $ print stats