blob: 61185d081663e41345abb4cce5e26d26380b9490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
-- |
-- Copyright : (c) Sam T. 2013
-- License : MIT
-- Maintainer : pxqr.sta@gmail.com
-- Stability : experimental
-- Portability : portable
--
{-# LANGUAGE RecordWildCards #-}
module Network.BitTorrent
( module BT
, module Data.Torrent
-- * Tracker
-- * P2P
, ClientSession, newClient
, SwarmSession, newLeacher, newSeeder
, PeerSession
, discover
) where
import Data.IORef
import Data.Torrent
import Network.BitTorrent.Internal
import Network.BitTorrent.Extension as BT
import Network.BitTorrent.Peer as BT
import Network.BitTorrent.Exchange as BT
import Network.BitTorrent.Tracker as BT
discover :: SwarmSession -> (TSession -> IO a) -> IO a
discover SwarmSession {..} action = do
let conn = TConnection (tAnnounce torrentMeta) (tInfoHash torrentMeta)
(clientPeerID clientSession) port
progress <- readIORef (currentProgress clientSession)
withTracker progress conn action
port = 10000
|