diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-15 21:31:33 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-15 21:31:33 +0400 |
commit | 74aa8dffa1d754a296c56c21f2084ce90e17f81d (patch) | |
tree | 05e74177c532d631587ceacb2466c8f575f1d536 | |
parent | 8e5a5dd9b950091f65ff5a4e12e62777bd0ea3f2 (diff) |
Add stubs for TEX
-rw-r--r-- | src/Network/BitTorrent/Tracker.hs | 6 | ||||
-rw-r--r-- | src/Network/BitTorrent/Tracker/Session.hs | 40 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Tracker/SessionSpec.hs | 1 |
3 files changed, 39 insertions, 8 deletions
diff --git a/src/Network/BitTorrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs index 6af76a16..f43b5dc2 100644 --- a/src/Network/BitTorrent/Tracker.hs +++ b/src/Network/BitTorrent/Tracker.hs | |||
@@ -11,9 +11,8 @@ | |||
11 | -- | 11 | -- |
12 | {-# LANGUAGE TemplateHaskell #-} | 12 | {-# LANGUAGE TemplateHaskell #-} |
13 | module Network.BitTorrent.Tracker | 13 | module Network.BitTorrent.Tracker |
14 | ( PeerInfo (..) | 14 | ( -- * RPC Manager |
15 | 15 | PeerInfo (..) | |
16 | -- * RPC Manager | ||
17 | , Options | 16 | , Options |
18 | , Manager | 17 | , Manager |
19 | , newManager | 18 | , newManager |
@@ -35,6 +34,7 @@ module Network.BitTorrent.Tracker | |||
35 | -- , getSessionState | 34 | -- , getSessionState |
36 | ) where | 35 | ) where |
37 | 36 | ||
37 | import Network.BitTorrent.Tracker.Message | ||
38 | import Network.BitTorrent.Tracker.List | 38 | import Network.BitTorrent.Tracker.List |
39 | import Network.BitTorrent.Tracker.RPC | 39 | import Network.BitTorrent.Tracker.RPC |
40 | import Network.BitTorrent.Tracker.Session | 40 | import Network.BitTorrent.Tracker.Session |
diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs index 295f9322..9b7654dd 100644 --- a/src/Network/BitTorrent/Tracker/Session.hs +++ b/src/Network/BitTorrent/Tracker/Session.hs | |||
@@ -13,12 +13,16 @@ module Network.BitTorrent.Tracker.Session | |||
13 | , newSession | 13 | , newSession |
14 | , closeSession | 14 | , closeSession |
15 | 15 | ||
16 | -- * Events | 16 | -- * Trackers |
17 | , Event (..) | ||
18 | , notify | 17 | , notify |
19 | |||
20 | -- * Query | ||
21 | , askPeers | 18 | , askPeers |
19 | |||
20 | -- * Tracker Exchange | ||
21 | -- | BEP28: <http://www.bittorrent.org/beps/bep_0028.html> | ||
22 | , addTracker | ||
23 | , removeTracker | ||
24 | , getTrackers | ||
25 | , getTrustedTrackers | ||
22 | ) where | 26 | ) where |
23 | 27 | ||
24 | import Control.Applicative | 28 | import Control.Applicative |
@@ -194,6 +198,32 @@ data TrackerInfo = TrackerInfo | |||
194 | --instance ToJSON TrackerInfo where | 198 | --instance ToJSON TrackerInfo where |
195 | -- toJSON = undefined | 199 | -- toJSON = undefined |
196 | 200 | ||
197 | -- | | ||
198 | --getSessionState :: Session -> IO (TrackerList TrackerInfo) | 201 | --getSessionState :: Session -> IO (TrackerList TrackerInfo) |
199 | --getSessionState = undefined | 202 | --getSessionState = undefined |
203 | |||
204 | {----------------------------------------------------------------------- | ||
205 | -- Tracker exchange | ||
206 | -----------------------------------------------------------------------} | ||
207 | |||
208 | -- Trackers discovered through this protocol SHOULD be treated with a | ||
209 | -- certain amount of suspicion. Since the source of a tracker exchange | ||
210 | -- message cannot be trusted, an implementation SHOULD have a lower | ||
211 | -- number of retries before giving up entirely. | ||
212 | |||
213 | addTracker :: Session -> URI -> IO () | ||
214 | addTracker = undefined | ||
215 | |||
216 | removeTracker :: Session -> URI -> IO () | ||
217 | removeTracker = undefined | ||
218 | |||
219 | -- Also, as specified under the definitions section, a tracker that | ||
220 | -- has not worked should never be propagated to other peers over the | ||
221 | -- tracker exchange protocol. | ||
222 | |||
223 | -- | Return all known trackers. | ||
224 | getTrackers :: Session -> IO [URI] | ||
225 | getTrackers = undefined | ||
226 | |||
227 | -- | Return trackers from torrent file and | ||
228 | getTrustedTrackers :: Session -> IO [URI] | ||
229 | getTrustedTrackers = undefined | ||
diff --git a/tests/Network/BitTorrent/Tracker/SessionSpec.hs b/tests/Network/BitTorrent/Tracker/SessionSpec.hs index db86b60e..2abe7bc0 100644 --- a/tests/Network/BitTorrent/Tracker/SessionSpec.hs +++ b/tests/Network/BitTorrent/Tracker/SessionSpec.hs | |||
@@ -5,6 +5,7 @@ import Network.URI | |||
5 | import Test.Hspec | 5 | import Test.Hspec |
6 | 6 | ||
7 | import Data.Torrent | 7 | import Data.Torrent |
8 | import Network.BitTorrent.Tracker.Message | ||
8 | import Network.BitTorrent.Tracker.List | 9 | import Network.BitTorrent.Tracker.List |
9 | import Network.BitTorrent.Tracker.RPC | 10 | import Network.BitTorrent.Tracker.RPC |
10 | import Network.BitTorrent.Tracker.Session | 11 | import Network.BitTorrent.Tracker.Session |