]> git.rkrishnan.org Git - functorrent.git/blobdiff - src/FuncTorrent/Peer.hs
Peer.hs: handle HaveMsg
[functorrent.git] / src / FuncTorrent / Peer.hs
index 05ecc3c961351ddff93b24de9e863f38cb25b749..300101895f7f692f7ca4d99afd615be9db579378 100644 (file)
@@ -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