summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-16 07:48:12 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-16 07:48:12 +0400
commit8c6e5818ee6b901efd975392c54aff5cf2721ae4 (patch)
tree85508d873378f3c0bfac21d09107ba6ff6155346 /src/Network/BitTorrent/Exchange.hs
parent7ad3fd1f6fe3c6719b69f3638542f24b32a3b09c (diff)
~ A few fixes in session.
Diffstat (limited to 'src/Network/BitTorrent/Exchange.hs')
-rw-r--r--src/Network/BitTorrent/Exchange.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Exchange.hs b/src/Network/BitTorrent/Exchange.hs
index b2d639f6..dc1b2752 100644
--- a/src/Network/BitTorrent/Exchange.hs
+++ b/src/Network/BitTorrent/Exchange.hs
@@ -464,16 +464,15 @@ exchange :: Storage -> P2P ()
464exchange storage = {-# SCC exchange #-} awaitEvent >>= handler 464exchange storage = {-# SCC exchange #-} awaitEvent >>= handler
465 where 465 where
466 handler (Available bf) = do 466 handler (Available bf) = do
467 liftIO $ print (completeness bf)
468 ixs <- selBlk (findMin bf) storage 467 ixs <- selBlk (findMin bf) storage
469 mapM_ (yieldEvent . Want) ixs -- TODO yield vectored 468 mapM_ (yieldEvent . Want) ixs -- TODO yield vectored
470 469
471 handler (Want bix) = do 470 handler (Want bix) = do
471 liftIO $ print bix
472 blk <- liftIO $ getBlk bix storage 472 blk <- liftIO $ getBlk bix storage
473 yieldEvent (Fragment blk) 473 yieldEvent (Fragment blk)
474 474
475 handler (Fragment blk @ Block {..}) = do 475 handler (Fragment blk @ Block {..}) = do
476 liftIO $ print (ppBlock blk)
477 done <- liftIO $ putBlk blk storage 476 done <- liftIO $ putBlk blk storage
478 when done $ do 477 when done $ do
479 yieldEvent $ Available $ singleton blkPiece (succ blkPiece) 478 yieldEvent $ Available $ singleton blkPiece (succ blkPiece)