summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Client/Handle.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Network/BitTorrent/Client/Handle.hs b/src/Network/BitTorrent/Client/Handle.hs
index 2da3b357..a1bc163c 100644
--- a/src/Network/BitTorrent/Client/Handle.hs
+++ b/src/Network/BitTorrent/Client/Handle.hs
@@ -14,11 +14,10 @@ module Network.BitTorrent.Client.Handle
14 14
15 -- * Query 15 -- * Query
16 , getHandle 16 , getHandle
17 , HandleState 17 , HandleStatus (..)
18 , getState 18 , getStatus
19 ) where 19 ) where
20 20
21import Control.Applicative
22import Control.Concurrent.Lifted as L 21import Control.Concurrent.Lifted as L
23import Control.Monad 22import Control.Monad
24import Control.Monad.Trans 23import Control.Monad.Trans
@@ -50,7 +49,7 @@ allocHandle ih m = do
50 49
51freeHandle :: InfoHash -> BitTorrent () -> BitTorrent () 50freeHandle :: InfoHash -> BitTorrent () -> BitTorrent ()
52freeHandle ih finalizer = do 51freeHandle ih finalizer = do
53 c @ Client {..} <- getClient 52 Client {..} <- getClient
54 modifyMVar_ clientTorrents $ \ handles -> do 53 modifyMVar_ clientTorrents $ \ handles -> do
55 case HM.lookup ih handles of 54 case HM.lookup ih handles of
56 Nothing -> return handles 55 Nothing -> return handles
@@ -90,7 +89,7 @@ openTorrent rootPath t @ Torrent {..} = do
90 89
91-- | Use 'nullMagnet' to open handle from 'InfoHash'. 90-- | Use 'nullMagnet' to open handle from 'InfoHash'.
92openMagnet :: FilePath -> Magnet -> BitTorrent Handle 91openMagnet :: FilePath -> Magnet -> BitTorrent Handle
93openMagnet rootPath uri @ Magnet {..} = do 92openMagnet rootPath Magnet {..} = do
94 allocHandle exactTopic $ do 93 allocHandle exactTopic $ do
95 tses <- liftIO $ Tracker.newSession exactTopic def 94 tses <- liftIO $ Tracker.newSession exactTopic def
96 eses <- newExchangeSession rootPath (Left exactTopic) 95 eses <- newExchangeSession rootPath (Left exactTopic)
@@ -149,7 +148,7 @@ stop Handle {..} = do
149-- Query 148-- Query
150-----------------------------------------------------------------------} 149-----------------------------------------------------------------------}
151 150
152data HandleState 151data HandleStatus
153 = Running 152 = Running
154 | Paused 153 | Paused
155 | Stopped 154 | Stopped
@@ -161,5 +160,5 @@ getHandle ih = do
161 Nothing -> error "should we throw some exception?" 160 Nothing -> error "should we throw some exception?"
162 Just h -> return h 161 Just h -> return h
163 162
164getState :: Handle -> IO HandleState 163getStatus :: Handle -> IO HandleStatus
165getState = undefined \ No newline at end of file 164getStatus = undefined