From: Ramakrishnan Muthukrishnan Date: Sat, 12 Aug 2017 11:01:13 +0000 (+0530) Subject: WIP: msg loop to send/recv infodict X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/css/index.php?a=commitdiff_plain;h=10c9204caa36be49d5ce9694f92bf13aa09ba2e7;p=functorrent.git WIP: msg loop to send/recv infodict --- 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