diff options
Diffstat (limited to 'exsamples/Main.hs')
-rw-r--r-- | exsamples/Main.hs | 13 |
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 @@ | |||
1 | module Main (main) where | 1 | module Main (main) where |
2 | 2 | ||
3 | import Control.Concurrent | ||
3 | import Data.Bitfield | 4 | import Data.Bitfield |
4 | import Network.BitTorrent | 5 | import Network.BitTorrent |
5 | import System.Environment | 6 | import System.Environment |
7 | import Control.Monad.Reader | ||
6 | 8 | ||
7 | 9 | ||
8 | main :: IO () | 10 | main :: 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 |