From 2d325c07ea48e8b6c8e1454db09ec06ba4235606 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org> Date: Thu, 7 May 2015 11:23:17 +0530 Subject: [PATCH] receive the full handshake msg from peer --- src/FuncTorrent/Peer.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 353e08a..95e2938 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -71,9 +71,8 @@ handShake (Peer _ ip port) infoHash peerid = do h <- connectTo ip (PortNumber (fromIntegral port)) hSetBuffering h LineBuffering hPut h hs - rlenBS <- hGet h 1 - let rlen = fromIntegral $ (unpack rlenBS) !! 0 - hGet h rlen + rlenBS <- hGet h (length (unpack hs)) + putStrLn $ "got handshake from peer: " ++ show rlenBS return h instance Binary PeerMsg where -- 2.45.2