From: Ramakrishnan Muthukrishnan Date: Sat, 27 Feb 2016 09:27:35 +0000 (+0530) Subject: Peer.hs: handle HaveMsg X-Git-Url: https://git.rkrishnan.org/(%5B%5E?a=commitdiff_plain;h=4d81876bc8ad7fa0ea3177a439104f1c71edd446;p=functorrent.git Peer.hs: handle HaveMsg --- diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs index 05ecc3c..3001018 100644 --- a/src/FuncTorrent/Peer.hs +++ b/src/FuncTorrent/Peer.hs @@ -151,7 +151,11 @@ msgLoop pieceStatus msgchannel = do msgLoop pieceStatus msgchannel PortMsg _ -> msgLoop pieceStatus msgchannel - -- handle RequestMsg, HaveMsg. No need to handle PieceMsg here. + HaveMsg idx -> do + p <- gets peer + let pieceStatus' = updatePieceAvailability pieceStatus p [idx] + msgLoop pieceStatus' msgchannel + -- handle RequestMsg. No need to handle PieceMsg here. -- also BitFieldMsg