diff options
Diffstat (limited to 'src/Network/BitTorrent/Exchange.hs')
-rw-r--r-- | src/Network/BitTorrent/Exchange.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Exchange.hs b/src/Network/BitTorrent/Exchange.hs index 52b5f690..b2d639f6 100644 --- a/src/Network/BitTorrent/Exchange.hs +++ b/src/Network/BitTorrent/Exchange.hs | |||
@@ -60,6 +60,7 @@ module Network.BitTorrent.Exchange | |||
60 | , yieldEvent | 60 | , yieldEvent |
61 | , handleEvent | 61 | , handleEvent |
62 | , exchange | 62 | , exchange |
63 | , p2p | ||
63 | 64 | ||
64 | -- * Exceptions | 65 | -- * Exceptions |
65 | , disconnect | 66 | , disconnect |
@@ -483,3 +484,13 @@ exchange storage = {-# SCC exchange #-} awaitEvent >>= handler | |||
483 | if BF.null offer | 484 | if BF.null offer |
484 | then return () | 485 | then return () |
485 | else handler (Available offer) | 486 | else handler (Available offer) |
487 | |||
488 | yieldInit :: P2P () | ||
489 | yieldInit = yieldMessage . Bitfield =<< getClientBF | ||
490 | |||
491 | p2p :: P2P () | ||
492 | p2p = do | ||
493 | yieldInit | ||
494 | storage <- asks (storage . swarmSession) | ||
495 | forever $ do | ||
496 | exchange storage \ No newline at end of file | ||