summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Client/Handle.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Client/Handle.hs')
-rw-r--r--src/Network/BitTorrent/Client/Handle.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Client/Handle.hs b/src/Network/BitTorrent/Client/Handle.hs
index 9601e691..5bcb2d33 100644
--- a/src/Network/BitTorrent/Client/Handle.hs
+++ b/src/Network/BitTorrent/Client/Handle.hs
@@ -71,10 +71,10 @@ lookupHandle ih = do
71-- Initialization 71-- Initialization
72-----------------------------------------------------------------------} 72-----------------------------------------------------------------------}
73 73
74newExchangeSession :: FilePath -> InfoDict -> BitTorrent Exchange.Session 74newExchangeSession :: FilePath -> Either InfoHash InfoDict -> BitTorrent Exchange.Session
75newExchangeSession rootPath dict = do 75newExchangeSession rootPath source = do
76 c @ Client {..} <- getClient 76 c @ Client {..} <- getClient
77 liftIO $ Exchange.newSession clientLogger (externalAddr c) rootPath dict 77 liftIO $ Exchange.newSession clientLogger (externalAddr c) rootPath source
78 78
79-- | Open a torrent in 'stop'ed state. Use 'nullTorrent' to open 79-- | Open a torrent in 'stop'ed state. Use 'nullTorrent' to open
80-- handle from 'InfoDict'. This operation do not block. 80-- handle from 'InfoDict'. This operation do not block.
@@ -83,7 +83,7 @@ openTorrent rootPath t @ Torrent {..} = do
83 let ih = idInfoHash tInfoDict 83 let ih = idInfoHash tInfoDict
84 allocHandle ih $ do 84 allocHandle ih $ do
85 tses <- liftIO $ Tracker.newSession ih (trackerList t) 85 tses <- liftIO $ Tracker.newSession ih (trackerList t)
86 eses <- newExchangeSession rootPath tInfoDict 86 eses <- newExchangeSession rootPath (Right tInfoDict)
87 return $ Handle 87 return $ Handle
88 { handleTopic = ih 88 { handleTopic = ih
89 , handlePrivate = idPrivate tInfoDict 89 , handlePrivate = idPrivate tInfoDict
@@ -96,7 +96,7 @@ openMagnet :: FilePath -> Magnet -> BitTorrent Handle
96openMagnet rootPath uri @ Magnet {..} = do 96openMagnet rootPath uri @ Magnet {..} = do
97 allocHandle exactTopic $ do 97 allocHandle exactTopic $ do
98 tses <- liftIO $ Tracker.newSession exactTopic def 98 tses <- liftIO $ Tracker.newSession exactTopic def
99 eses <- newExchangeSession rootPath (error "openMagnet" exactTopic) 99 eses <- newExchangeSession rootPath (Left exactTopic)
100 return $ Handle 100 return $ Handle
101 { handleTopic = exactTopic 101 { handleTopic = exactTopic
102 , handlePrivate = False 102 , handlePrivate = False