]> git.rkrishnan.org Git - functorrent.git/blobdiff - src/FuncTorrent/Peer.hs
receive the full handshake msg from peer
[functorrent.git] / 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