summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-12 06:34:19 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-12 06:34:19 +0400
commit8b005c4eb0f58db974c342efe0821240f39a6331 (patch)
tree85a32db63949ed1082a61100b71fcb830e1044e5 /src/Network/BitTorrent.hs
parent7f27eec9bf34a513f7a28072468706e8975ef552 (diff)
+ Rename to await and yield.
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r--src/Network/BitTorrent.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs
index e9b5f17d..f7c4c004 100644
--- a/src/Network/BitTorrent.hs
+++ b/src/Network/BitTorrent.hs
@@ -22,10 +22,11 @@ module Network.BitTorrent
22 22
23 -- * Peer to Peer 23 -- * Peer to Peer
24 , P2P 24 , P2P
25 , Event(..)
25 , PeerSession ( connectedPeerAddr, enabledExtensions ) 26 , PeerSession ( connectedPeerAddr, enabledExtensions )
26 , Block(..), BlockIx(..) 27 , Block(..), BlockIx(..), ppBlock, ppBlockIx
27 28
28 , awaitEvent, signalEvent 29 , awaitEvent, yieldEvent
29 ) where 30 ) where
30 31
31import Control.Monad 32import Control.Monad
@@ -34,6 +35,7 @@ import Data.IORef
34import Data.Torrent 35import Data.Torrent
35import Network.BitTorrent.Internal 36import Network.BitTorrent.Internal
36import Network.BitTorrent.Exchange 37import Network.BitTorrent.Exchange
38import Network.BitTorrent.Exchange.Protocol
37import Network.BitTorrent.Tracker 39import Network.BitTorrent.Tracker
38 40
39 41
@@ -49,10 +51,14 @@ discover swarm action = do
49 port 51 port
50 52
51 progress <- getCurrentProgress (clientSession swarm) 53 progress <- getCurrentProgress (clientSession swarm)
54
55 putStrLn "lookup peers"
52 withTracker progress conn $ \tses -> do 56 withTracker progress conn $ \tses -> do
53 forever $ do 57 forever $ do
54 addr <- getPeerAddr tses 58 addr <- getPeerAddr tses
59 putStrLn "connecting to peer"
55 withPeer swarm addr action 60 withPeer swarm addr action
56 61
57 62
63
58port = 10000 64port = 10000