diff options
Diffstat (limited to 'src/Network/BitTorrent/Sessions.hs')
-rw-r--r-- | src/Network/BitTorrent/Sessions.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Network/BitTorrent/Sessions.hs b/src/Network/BitTorrent/Sessions.hs index 9713f438..0f0d7ecd 100644 --- a/src/Network/BitTorrent/Sessions.hs +++ b/src/Network/BitTorrent/Sessions.hs | |||
@@ -58,6 +58,7 @@ import Prelude hiding (mapM_, elem) | |||
58 | import Control.Applicative | 58 | import Control.Applicative |
59 | import Control.Concurrent | 59 | import Control.Concurrent |
60 | import Control.Concurrent.STM | 60 | import Control.Concurrent.STM |
61 | import Control.Concurrent.BoundedChan as BC | ||
61 | import Control.Concurrent.MSem as MSem | 62 | import Control.Concurrent.MSem as MSem |
62 | import Control.Monad (forever, (>=>)) | 63 | import Control.Monad (forever, (>=>)) |
63 | import Control.Exception | 64 | import Control.Exception |
@@ -202,12 +203,12 @@ discover swarm @ SwarmSession {..} = {-# SCC discover #-} do | |||
202 | , tconnPort = port | 203 | , tconnPort = port |
203 | } | 204 | } |
204 | 205 | ||
205 | progress <- getCurrentProgress clientSession | 206 | let progress = currentProgress clientSession |
206 | 207 | ch <- newBoundedChan 100 -- TODO | |
207 | withTracker progress conn $ \tses -> do | 208 | tid <- forkIO $ tracker ch progress conn |
208 | forever $ do | 209 | forever $ do |
209 | addr <- getPeerAddr tses | 210 | addr <- BC.readChan ch |
210 | forkThrottle swarm $ do | 211 | forkThrottle swarm $ do |
211 | initiatePeerSession swarm addr $ \pconn -> do | 212 | initiatePeerSession swarm addr $ \pconn -> do |
212 | print addr | 213 | print addr |
213 | runP2P pconn p2p | 214 | runP2P pconn p2p |