diff options
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r-- | src/Network/BitTorrent.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index 8f0f42ce..e9b5f17d 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs | |||
@@ -21,10 +21,9 @@ module Network.BitTorrent | |||
21 | , discover | 21 | , discover |
22 | 22 | ||
23 | -- * Peer to Peer | 23 | -- * Peer to Peer |
24 | , P2P, PeerSession | 24 | , P2P |
25 | ( connectedPeerAddr, enabledExtensions | 25 | , PeerSession ( connectedPeerAddr, enabledExtensions ) |
26 | , peerBitfield, peerSessionStatus | 26 | , Block(..), BlockIx(..) |
27 | ) | ||
28 | 27 | ||
29 | , awaitEvent, signalEvent | 28 | , awaitEvent, signalEvent |
30 | ) where | 29 | ) where |
@@ -43,10 +42,13 @@ import Network.BitTorrent.Tracker | |||
43 | -- thus we can obtain unified interface | 42 | -- thus we can obtain unified interface |
44 | 43 | ||
45 | discover :: SwarmSession -> P2P () -> IO () | 44 | discover :: SwarmSession -> P2P () -> IO () |
46 | discover swarm @ SwarmSession {..} action = do | 45 | discover swarm action = do |
47 | let conn = TConnection (tAnnounce torrentMeta) (tInfoHash torrentMeta) | 46 | let conn = TConnection (tAnnounce (torrentMeta swarm)) |
48 | (clientPeerID clientSession) port | 47 | (tInfoHash (torrentMeta swarm)) |
49 | progress <- readIORef (currentProgress clientSession) | 48 | (clientPeerID (clientSession swarm)) |
49 | port | ||
50 | |||
51 | progress <- getCurrentProgress (clientSession swarm) | ||
50 | withTracker progress conn $ \tses -> do | 52 | withTracker progress conn $ \tses -> do |
51 | forever $ do | 53 | forever $ do |
52 | addr <- getPeerAddr tses | 54 | addr <- getPeerAddr tses |