summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Client/Handle.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Client/Handle.hs b/src/Network/BitTorrent/Client/Handle.hs
index d68c57cc..a1fe7b9e 100644
--- a/src/Network/BitTorrent/Client/Handle.hs
+++ b/src/Network/BitTorrent/Client/Handle.hs
@@ -22,6 +22,7 @@ import Control.Applicative
22import Control.Concurrent 22import Control.Concurrent
23import Control.Monad 23import Control.Monad
24import Control.Monad.Trans 24import Control.Monad.Trans
25import Data.Default
25import Data.List as L 26import Data.List as L
26import Data.HashMap.Strict as HM 27import Data.HashMap.Strict as HM
27 28
@@ -89,7 +90,18 @@ openTorrent rootPath t @ Torrent {..} = do
89 90
90-- | Use 'nullMagnet' to open handle from 'InfoHash'. 91-- | Use 'nullMagnet' to open handle from 'InfoHash'.
91openMagnet :: FilePath -> Magnet -> BitTorrent Handle 92openMagnet :: FilePath -> Magnet -> BitTorrent Handle
92openMagnet rootPath uri @ Magnet {..} = error "openMagnet: not implemnted" 93openMagnet rootPath uri @ Magnet {..} = do
94 allocHandle exactTopic $ do
95 c @ Client {..} <- getClient
96 tses <- liftIO $ Tracker.newSession exactTopic def
97 eses <- liftIO $ Exchange.newSession clientLogger (externalAddr c)
98 rootPath (error "openMagnet" exactTopic)
99 return $ Handle
100 { topic = exactTopic
101 , private = False
102 , trackers = tses
103 , exchange = eses
104 }
93 105
94-- | Stop torrent and destroy all sessions. You don't need to close 106-- | Stop torrent and destroy all sessions. You don't need to close
95-- handles at application exit, all handles will be automatically 107-- handles at application exit, all handles will be automatically