diff options
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r-- | src/Network/BitTorrent.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index 5fbc5ff6..61185d08 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs | |||
@@ -5,6 +5,7 @@ | |||
5 | -- Stability : experimental | 5 | -- Stability : experimental |
6 | -- Portability : portable | 6 | -- Portability : portable |
7 | -- | 7 | -- |
8 | {-# LANGUAGE RecordWildCards #-} | ||
8 | module Network.BitTorrent | 9 | module Network.BitTorrent |
9 | ( module BT | 10 | ( module BT |
10 | , module Data.Torrent | 11 | , module Data.Torrent |
@@ -15,8 +16,11 @@ module Network.BitTorrent | |||
15 | , ClientSession, newClient | 16 | , ClientSession, newClient |
16 | , SwarmSession, newLeacher, newSeeder | 17 | , SwarmSession, newLeacher, newSeeder |
17 | , PeerSession | 18 | , PeerSession |
19 | , discover | ||
18 | ) where | 20 | ) where |
19 | 21 | ||
22 | import Data.IORef | ||
23 | |||
20 | import Data.Torrent | 24 | import Data.Torrent |
21 | import Network.BitTorrent.Internal | 25 | import Network.BitTorrent.Internal |
22 | import Network.BitTorrent.Extension as BT | 26 | import Network.BitTorrent.Extension as BT |
@@ -24,5 +28,12 @@ import Network.BitTorrent.Peer as BT | |||
24 | import Network.BitTorrent.Exchange as BT | 28 | import Network.BitTorrent.Exchange as BT |
25 | import Network.BitTorrent.Tracker as BT | 29 | import Network.BitTorrent.Tracker as BT |
26 | 30 | ||
27 | --discover :: SwarmSession -> ([PeerAddr] -> IO a) -> IO a | 31 | |
28 | --discover = withTracker | 32 | discover :: SwarmSession -> (TSession -> IO a) -> IO a |
33 | discover SwarmSession {..} action = do | ||
34 | let conn = TConnection (tAnnounce torrentMeta) (tInfoHash torrentMeta) | ||
35 | (clientPeerID clientSession) port | ||
36 | progress <- readIORef (currentProgress clientSession) | ||
37 | withTracker progress conn action | ||
38 | |||
39 | port = 10000 | ||