summaryrefslogtreecommitdiff
path: root/exsamples
diff options
context:
space:
mode:
Diffstat (limited to 'exsamples')
-rw-r--r--exsamples/Main.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/exsamples/Main.hs b/exsamples/Main.hs
index b0224886..81958613 100644
--- a/exsamples/Main.hs
+++ b/exsamples/Main.hs
@@ -1,8 +1,10 @@
1module Main (main) where 1module Main (main) where
2 2
3import Control.Concurrent
3import Data.Bitfield 4import Data.Bitfield
4import Network.BitTorrent 5import Network.BitTorrent
5import System.Environment 6import System.Environment
7import Control.Monad.Reader
6 8
7 9
8main :: IO () 10main :: IO ()
@@ -13,8 +15,11 @@ main = do
13 client <- newClient [] 15 client <- newClient []
14 swarm <- newLeacher client torrent 16 swarm <- newLeacher client torrent
15 17
16 discover swarm $ \se -> do 18 discover swarm $ do
17 peers <- getPeerList se 19 addr <- asks connectedPeerAddr
18 print peers 20 liftIO $ print $ "connected to" ++ show addr
21 e <- awaitEvent
22 liftIO $ print e
23 liftIO $ threadDelay (100 * 1000000)
19 24
20 print "Bye-bye!" \ No newline at end of file 25 print "Bye-bye! =_=" \ No newline at end of file