summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Client
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Client')
-rw-r--r--src/Network/BitTorrent/Client/Swarm.hs15
1 files changed, 9 insertions, 6 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