From: Ramakrishnan Muthukrishnan Date: Thu, 7 May 2015 05:53:17 +0000 (+0530) Subject: receive the full handshake msg from peer X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/simplejson/frontends/install.html?a=commitdiff_plain;h=2d325c07ea48e8b6c8e1454db09ec06ba4235606;p=functorrent.git receive the full handshake msg from peer --- 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