summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-04 07:02:47 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-04 07:02:47 +0400
commiteaf426da786acf925a1786938c5ae2b1c9230a07 (patch)
treea5a388f783204ecfe170b99de7ad5edc64b95e4c /src/Network/BitTorrent
parentfe07542caf980e24d2e2fc4ec829ea2286f17367 (diff)
Remove orphan module
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/Client/Swarm.hs15
-rw-r--r--src/Network/BitTorrent/Tracker/Session.hs56
2 files changed, 9 insertions, 62 deletions
diff --git a/src/Network/BitTorrent/Client/Swarm.hs b/src/Network/BitTorrent/Client/Swarm.hs
index 7fdd1f2f..bd48f8a4 100644
--- a/src/Network/BitTorrent/Client/Swarm.hs
+++ b/src/Network/BitTorrent/Client/Swarm.hs
@@ -5,6 +5,7 @@ module Network.BitTorrent.Client.Swarm
5 ) where 5 ) where
6 6
7import Data.Default 7import Data.Default
8import Data.Maybe
8import Network 9import Network
9 10
10import Data.Torrent 11import Data.Torrent
@@ -18,18 +19,14 @@ data Swarm = Swarm
18 { swarmTopic :: InfoHash 19 { swarmTopic :: InfoHash
19 , thisPeerId :: PeerId 20 , thisPeerId :: PeerId
20 , listenerPort :: PortNumber 21 , listenerPort :: PortNumber
21 , trackerConn :: Tracker
22-- , infoDict ::
23 } 22 }
24 23
25newLeecher :: PeerId -> PortNumber -> Torrent -> IO Swarm 24newLeecher :: PeerId -> PortNumber -> Torrent -> IO Swarm
26newLeecher pid port Torrent {..} = do 25newLeecher pid port Torrent {..} = do
27 tracker <- connect undefined
28 return Swarm 26 return Swarm
29 { swarmTopic = idInfoHash tInfoDict 27 { swarmTopic = idInfoHash tInfoDict
30 , thisPeerId = pid 28 , thisPeerId = pid
31 , listenerPort = port 29 , listenerPort = port
32 , trackerConn = tracker
33 } 30 }
34 31
35getAnnounceQuery :: Swarm -> AnnounceQuery 32getAnnounceQuery :: Swarm -> AnnounceQuery
@@ -45,5 +42,11 @@ getAnnounceQuery Swarm {..} = AnnounceQuery
45 42
46askPeers :: Swarm -> IO [PeerAddr IP] 43askPeers :: Swarm -> IO [PeerAddr IP]
47askPeers s @ Swarm {..} = do 44askPeers s @ Swarm {..} = do
48 AnnounceInfo {..} <- RPC.announce (getAnnounceQuery s) trackerConn 45-- AnnounceInfo {..} <- RPC.announce (getAnnounceQuery s) trackerConn
49 return (getPeerList respPeers) 46 return [] -- (getPeerList respPeers)
47
48--reannounce :: HTracker -> IO ()
49--reannounce = undefined
50
51--forceReannounce :: HTracker -> IO ()
52--forceReannounce = undefined
diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs
deleted file mode 100644
index 3cfc4b52..00000000
--- a/src/Network/BitTorrent/Tracker/Session.hs
+++ /dev/null
@@ -1,56 +0,0 @@
1module Network.BitTorrent.Tracker.Session
2 (
3 ) where
4
5import Data.Torrent.Progress
6import Data.Torrent.InfoHash
7import Network.BitTorrent.Core.PeerAddr
8import Network.BitTorrent.Tracker.Message
9
10data PeerInfo = PeerInfo
11 { peerId :: PeerId
12 , peerPort :: PortNumber
13 , peerIP :: Maybe HostAddress
14 }
15
16data Session = Session
17 { sesInfoHash :: !InfoHash
18 , sesPeerInfo :: !PeerInfo
19 }
20
21data SAnnounceQuery = SAnnounceQuery
22 { sreqProgress :: Progress
23 , sreqNumWant :: Maybe Int
24 , sreqEvent :: Maybe Event
25 }
26
27type SAnnounceInfo = [PeerAddr]
28
29f :: Session -> SAnnounceQuery -> AnnounceQuery
30f Session {..} SAnnounceQuery {..} = AnnounceQuery
31 { reqInfoHash = sesInfoHash
32 , reqPeerInfo = sesPeerInfo
33 , reqProgress = sreqProgress
34 , reqNumWant = undefined
35 , reqEvent = sreqEvent
36 }
37
38data Settings = Settings
39
40data Manager = Manager
41 {
42 }
43
44
45g :: Session -> AnnounceInfo -> SAnnounceInfo
46g Session {..} SAnnounceInfo {..} = undefined
47
48
49reannounce :: HTracker -> IO ()
50reannounce = undefined
51
52forceReannounce :: HTracker -> IO ()
53forceReannounce = undefined
54
55scrape :: HTracker -> IO ()
56scrape = undefined