From: Ramakrishnan Muthukrishnan Date: Fri, 24 Jul 2015 08:22:36 +0000 (+0530) Subject: bug: if I am uninterested and he is choking, send interested msg X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/frontends/flags/%3C?a=commitdiff_plain;h=e9106060a1493f98c88917e9b91f1ae28dbf86f4;p=functorrent.git bug: if I am uninterested and he is choking, send interested msg --- diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 6a47a35..2130ffe 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -199,13 +199,13 @@ msgLoop state pieceStatus = do -- and send a requestmsg. let isMeInterested = meInterested state isHeChoking = heChoking state - if (isMeInterested && isHeChoking) + if (not isMeInterested && isHeChoking) then do let h = handle state sendMsg h InterestedMsg putStrLn $ "--> InterestedMsg to peer: " ++ show (peer state) - msgLoop state pieceStatus + msgLoop (state { meInterested = True }) pieceStatus else do msg <- getMsg (handle state) @@ -223,7 +223,7 @@ msgLoop state pieceStatus = do -- download each of the piece in order msgLoop state pieceStatus' UnChokeMsg -> do - msgLoop (state {heChoking = False}) pieceStatus + msgLoop (state { heChoking = False }) pieceStatus _ -> do msgLoop state pieceStatus