summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Sessions.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Sessions.hs')
-rw-r--r--src/Network/BitTorrent/Sessions.hs13
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)
58import Control.Applicative 58import Control.Applicative
59import Control.Concurrent 59import Control.Concurrent
60import Control.Concurrent.STM 60import Control.Concurrent.STM
61import Control.Concurrent.BoundedChan as BC
61import Control.Concurrent.MSem as MSem 62import Control.Concurrent.MSem as MSem
62import Control.Monad (forever, (>=>)) 63import Control.Monad (forever, (>=>))
63import Control.Exception 64import 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