From 0214143031eb11d2935dec29d2c88d7a011e5d9e Mon Sep 17 00:00:00 2001 From: Sam T Date: Sun, 7 Jul 2013 02:50:52 +0400 Subject: ~ Another Literate Haskell test. --- src/Network/BitTorrent.hs | 22 ++++++++++++++++++++++ src/Network/BitTorrent/Internal.hs | 4 ++++ 2 files changed, 26 insertions(+) (limited to 'src/Network') diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index c72498d0..ea6b88bd 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs @@ -115,3 +115,25 @@ discover swarm @ SwarmSession {..} action = {-# SCC discover #-} do addr <- getPeerAddr tses spawnP2P swarm addr $ do action + +{----------------------------------------------------------------------- + Torrent management +-----------------------------------------------------------------------} +{- +addTorrent :: ClientSession -> TorrentLoc -> IO () +addTorrent ClientSession {..} TorrentLoc {..} = do + torrent <- fromFile metafilePath + swarm <- newLeecher clientSession torrent + storage <- swarm `bindTo` dataDir + discover swarm $ do + liftIO $ putStrLn "connected to peer" + forever $ do + liftIO $ putStrLn "from mesage loop" + exchange storage + +removeTorrent :: ClientSession -> TorrentLoc -> IO () +removeTorrent ClientSession {..} TorrentLoc {..} = undefined + +deleteTorrent :: ClientSession -> TorrentLoc -> IO () +deleteTorrent ClientSession {..} TorrentLoc {..} = undefined +-} \ No newline at end of file diff --git a/src/Network/BitTorrent/Internal.hs b/src/Network/BitTorrent/Internal.hs index 964dfd75..dd5f3bb7 100644 --- a/src/Network/BitTorrent/Internal.hs +++ b/src/Network/BitTorrent/Internal.hs @@ -55,6 +55,10 @@ module Network.BitTorrent.Internal , ThreadCount , defaultThreadCount + , TorrentLoc(..) + , registerTorrent + , unregisterTorrent + , newClient , getCurrentProgress -- cgit v1.2.3