From 46dc8fae54b98a586eb393c639716bbf3065255d Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Wed, 15 Jun 2016 10:31:36 +0530 Subject: [PATCH] Tracker/Udp.hs: pass a proper peer id --- src/FuncTorrent/Tracker/Udp.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.37.2