X-Git-Url: https://git.rkrishnan.org/?p=functorrent.git;a=blobdiff_plain;f=src%2FFuncTorrent%2FPeer.hs;fp=src%2FFuncTorrent%2FPeer.hs;h=1c6bf7f77472c00d94c2197e3dd3fa3c0d002b1d;hp=4396c1c004bd5364c9a75deecb34b862d3c10dc7;hb=10c9204caa36be49d5ce9694f92bf13aa09ba2e7;hpb=d80bf91010f9f2f8653c55bb902ec83bf1f034a2 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