diff options
Diffstat (limited to 'src/Network/BitTorrent/Client')
-rw-r--r-- | src/Network/BitTorrent/Client/Handle.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/Client/Handle.hs b/src/Network/BitTorrent/Client/Handle.hs index 39d8393a..7aaaf5aa 100644 --- a/src/Network/BitTorrent/Client/Handle.hs +++ b/src/Network/BitTorrent/Client/Handle.hs | |||
@@ -71,12 +71,13 @@ lookupHandle ih = do | |||
71 | 71 | ||
72 | -- | Open a torrent in 'stop'ed state. Use 'nullTorrent' to open | 72 | -- | Open a torrent in 'stop'ed state. Use 'nullTorrent' to open |
73 | -- handle from 'InfoDict'. This operation do not block. | 73 | -- handle from 'InfoDict'. This operation do not block. |
74 | openTorrent :: Torrent -> BitTorrent Handle | 74 | openTorrent :: FilePath -> Torrent -> BitTorrent Handle |
75 | openTorrent t @ Torrent {..} = do | 75 | openTorrent rootPath t @ Torrent {..} = do |
76 | let ih = idInfoHash tInfoDict | 76 | let ih = idInfoHash tInfoDict |
77 | allocHandle ih $ do | 77 | allocHandle ih $ do |
78 | c @ Client {..} <- getClient | ||
78 | tses <- liftIO $ Tracker.newSession ih (trackerList t) | 79 | tses <- liftIO $ Tracker.newSession ih (trackerList t) |
79 | eses <- liftIO $ Exchange.newSession undefined undefined undefined | 80 | eses <- liftIO $ Exchange.newSession (externalAddr c) rootPath tInfoDict |
80 | return $ Handle ih (idPrivate tInfoDict) tses eses | 81 | return $ Handle ih (idPrivate tInfoDict) tses eses |
81 | 82 | ||
82 | -- | Use 'nullMagnet' to open handle from 'InfoHash'. | 83 | -- | Use 'nullMagnet' to open handle from 'InfoHash'. |
@@ -91,6 +92,7 @@ closeHandle :: Handle -> BitTorrent () | |||
91 | closeHandle h @ Handle {..} = do | 92 | closeHandle h @ Handle {..} = do |
92 | freeHandle topic $ do | 93 | freeHandle topic $ do |
93 | stop h | 94 | stop h |
95 | liftIO $ Exchange.closeSession exchange | ||
94 | liftIO $ Tracker.closeSession trackers | 96 | liftIO $ Tracker.closeSession trackers |
95 | 97 | ||
96 | {----------------------------------------------------------------------- | 98 | {----------------------------------------------------------------------- |