summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/Sessions.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Sessions.hs b/src/Network/BitTorrent/Sessions.hs
index 5047f06c..4e58be5c 100644
--- a/src/Network/BitTorrent/Sessions.hs
+++ b/src/Network/BitTorrent/Sessions.hs
@@ -33,6 +33,7 @@ module Network.BitTorrent.Sessions
33 , getPeerCount 33 , getPeerCount
34 , getSwarm 34 , getSwarm
35 , getStorage 35 , getStorage
36 , getTorrentInfo
36 , openSwarmSession 37 , openSwarmSession
37 38
38 -- * Swarm 39 -- * Swarm
@@ -250,6 +251,14 @@ getSwarm cs @ ClientSession {..} ih = do
250getStorage :: ClientSession -> InfoHash -> IO Storage 251getStorage :: ClientSession -> InfoHash -> IO Storage
251getStorage cs ih = storage <$> getSwarm cs ih 252getStorage cs ih = storage <$> getSwarm cs ih
252 253
254getTorrentInfo :: ClientSession -> InfoHash -> IO (Maybe Torrent)
255getTorrentInfo cs ih = do
256 tstatus <- torrentPresence cs ih
257 case tstatus of
258 Unknown -> return Nothing
259 Active (SwarmSession {..}) -> return $ Just torrentMeta
260 Registered (TorrentLoc {..}) -> Just <$> fromFile metafilePath
261
253-- | Get the number of connected peers in the given swarm. 262-- | Get the number of connected peers in the given swarm.
254getSessionCount :: SwarmSession -> IO SessionCount 263getSessionCount :: SwarmSession -> IO SessionCount
255getSessionCount SwarmSession {..} = do 264getSessionCount SwarmSession {..} = do