summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r--src/Network/BitTorrent.hs15
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 #-}
8module Network.BitTorrent 9module 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
22import Data.IORef
23
20import Data.Torrent 24import Data.Torrent
21import Network.BitTorrent.Internal 25import Network.BitTorrent.Internal
22import Network.BitTorrent.Extension as BT 26import Network.BitTorrent.Extension as BT
@@ -24,5 +28,12 @@ import Network.BitTorrent.Peer as BT
24import Network.BitTorrent.Exchange as BT 28import Network.BitTorrent.Exchange as BT
25import Network.BitTorrent.Tracker as BT 29import Network.BitTorrent.Tracker as BT
26 30
27--discover :: SwarmSession -> ([PeerAddr] -> IO a) -> IO a 31
28--discover = withTracker 32discover :: SwarmSession -> (TSession -> IO a) -> IO a
33discover 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
39port = 10000