From 10c9204caa36be49d5ce9694f92bf13aa09ba2e7 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Sat, 12 Aug 2017 16:31:13 +0530 Subject: [PATCH] WIP: msg loop to send/recv infodict --- src/FuncTorrent/Peer.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 4396c1c..1c6bf7f 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -25,7 +25,7 @@ module FuncTorrent.Peer import Prelude hiding (lookup, concat, replicate, splitAt, take, drop) -import Control.Concurrent.MVar (MVar, readMVar, putMVar, takeMVar) +import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, putMVar, takeMVar) import Control.Monad.State import Data.ByteString (ByteString, unpack, concat, hGet, hPut, take, drop, empty, singleton) import Data.Bits @@ -71,6 +71,8 @@ doHandshake True h p infohash peerid = do putStrLn $ "--> handhake to peer: " ++ show p hsMsg <- hGet h (length (unpack hs)) putStrLn $ "<-- handshake from peer: " ++ show p + infoPieceMap <- newEmptyMVar + metadataMsgLoop h $ InfoState infoPieceMap return () -- if doesPeerSupportExtendedMsg hsMsg -- then -- 2.37.2