]> git.rkrishnan.org Git - functorrent.git/commitdiff
receive the full handshake msg from peer
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Thu, 7 May 2015 05:53:17 +0000 (11:23 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Thu, 7 May 2015 05:53:17 +0000 (11:23 +0530)
src/FuncTorrent/Peer.hs

index 353e08a9b759ebe51e15adb0edfd253549d8dcbd..95e29388d3829251189c7e7a96429c3c3f202561 100644 (file)
@@ -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