summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent.hs3
-rw-r--r--src/Network/BitTorrent/Client.hs11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs
index 8764d91d..7165900a 100644
--- a/src/Network/BitTorrent.hs
+++ b/src/Network/BitTorrent.hs
@@ -36,8 +36,11 @@ module Network.BitTorrent
36 , Torrent 36 , Torrent
37 37
38 -- ** Handle 38 -- ** Handle
39 , Handle
40 , topic
39 , TorrentSource(openHandle) 41 , TorrentSource(openHandle)
40 , closeHandle 42 , closeHandle
43 , getIndex
41 44
42 -- ** Control 45 -- ** Control
43 , start 46 , start
diff --git a/src/Network/BitTorrent/Client.hs b/src/Network/BitTorrent/Client.hs
index fce8cfe2..8e59d798 100644
--- a/src/Network/BitTorrent/Client.hs
+++ b/src/Network/BitTorrent/Client.hs
@@ -27,14 +27,18 @@ module Network.BitTorrent.Client
27 , getClient 27 , getClient
28 28
29 -- * Handle 29 -- * Handle
30 , Handle
31 , topic
30 , TorrentSource (..) 32 , TorrentSource (..)
31 , closeHandle 33 , closeHandle
34 , getIndex
32 35
33 , start 36 , start
34 , pause 37 , pause
35 , stop 38 , stop
36 ) where 39 ) where
37 40
41import Control.Applicative
38import Control.Exception 42import Control.Exception
39import Control.Concurrent 43import Control.Concurrent
40import Control.Monad.Logger 44import Control.Monad.Logger
@@ -172,4 +176,9 @@ instance TorrentSource FilePath where
172 openHandle contentDir torrentPath = do 176 openHandle contentDir torrentPath = do
173 t <- liftIO $ fromFile torrentPath 177 t <- liftIO $ fromFile torrentPath
174 openTorrent contentDir t 178 openTorrent contentDir t
175 {-# INLINE openHandle #-} \ No newline at end of file 179 {-# INLINE openHandle #-}
180
181getIndex :: BitTorrent [Handle]
182getIndex = do
183 Client {..} <- getClient
184 elems <$> liftIO (readMVar clientTorrents)