From 1d4b5f97c4323895d77aa197c3faf832c538aed9 Mon Sep 17 00:00:00 2001 From: Sam T Date: Fri, 28 Jun 2013 23:44:45 +0400 Subject: + Default P2P. --- src/Network/BitTorrent/Exchange.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Network/BitTorrent/Exchange.hs') diff --git a/src/Network/BitTorrent/Exchange.hs b/src/Network/BitTorrent/Exchange.hs index 2eedc6bd..3d05f7fc 100644 --- a/src/Network/BitTorrent/Exchange.hs +++ b/src/Network/BitTorrent/Exchange.hs @@ -58,6 +58,7 @@ module Network.BitTorrent.Exchange , Event(..) , awaitEvent , yieldEvent + , handleEvent -- * Exceptions , disconnect @@ -444,6 +445,10 @@ yieldEvent (Fragment blk) = do then yieldMessage (Piece blk) else return () + +handleEvent :: (Event -> P2P Event) -> P2P () +handleEvent action = awaitEvent >>= action >>= yieldEvent + --flushBroadcast :: P2P () --flushBroadcast = nextBroadcast >>= maybe (return ()) go -- where -- cgit v1.2.3