diff options
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Session.hs')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Session.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Exchange/Session.hs b/src/Network/BitTorrent/Exchange/Session.hs index 8c3d5388..32f8eabd 100644 --- a/src/Network/BitTorrent/Exchange/Session.hs +++ b/src/Network/BitTorrent/Exchange/Session.hs | |||
@@ -18,6 +18,7 @@ module Network.BitTorrent.Exchange.Session | |||
18 | 18 | ||
19 | -- * Events | 19 | -- * Events |
20 | , waitMetadata | 20 | , waitMetadata |
21 | , takeMetadata | ||
21 | ) where | 22 | ) where |
22 | 23 | ||
23 | import Control.Applicative | 24 | import Control.Applicative |
@@ -355,6 +356,9 @@ sendBroadcast msg = do | |||
355 | waitMetadata :: Session -> IO InfoDict | 356 | waitMetadata :: Session -> IO InfoDict |
356 | waitMetadata Session {..} = cachedValue <$> readMVar infodict | 357 | waitMetadata Session {..} = cachedValue <$> readMVar infodict |
357 | 358 | ||
359 | takeMetadata :: Session -> IO (Maybe InfoDict) | ||
360 | takeMetadata Session {..} = fmap cachedValue <$> tryReadMVar infodict | ||
361 | |||
358 | {----------------------------------------------------------------------- | 362 | {----------------------------------------------------------------------- |
359 | -- Triggers | 363 | -- Triggers |
360 | -----------------------------------------------------------------------} | 364 | -----------------------------------------------------------------------} |