summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-03-15 19:39:37 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-03-15 19:39:37 +0400
commit3d69529669259582e310c8340d6014cd81aca7ac (patch)
treefda7421e3571077c01a41aac01abeac750560e15 /src/Network/BitTorrent
parentb9ae0641f2b2f8afcc50a808dd00a84b29eaeee6 (diff)
Improve Tracker.Message documentation
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/Tracker/Message.hs59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/Network/BitTorrent/Tracker/Message.hs b/src/Network/BitTorrent/Tracker/Message.hs
index dc8794b6..17871133 100644
--- a/src/Network/BitTorrent/Tracker/Message.hs
+++ b/src/Network/BitTorrent/Tracker/Message.hs
@@ -35,15 +35,6 @@ module Network.BitTorrent.Tracker.Message
35 , ParamParseFailure 35 , ParamParseFailure
36 , parseAnnounceQuery 36 , parseAnnounceQuery
37 37
38 -- ** Request
39 , AnnounceQueryExt (..)
40 , renderAnnounceQueryExt
41 , parseAnnounceQueryExt
42
43 , AnnounceRequest (..)
44 , parseAnnounceRequest
45 , renderAnnounceRequest
46
47 -- ** Info 38 -- ** Info
48 , PeerList (..) 39 , PeerList (..)
49 , getPeerList 40 , getPeerList
@@ -63,9 +54,21 @@ module Network.BitTorrent.Tracker.Message
63 , ScrapeInfo 54 , ScrapeInfo
64 55
65 -- * HTTP specific 56 -- * HTTP specific
66 , RawPath 57 -- ** Routes
58 , PathPiece
67 , defaultAnnouncePath 59 , defaultAnnouncePath
68 , defaultScrapePath 60 , defaultScrapePath
61
62 -- ** Request
63 , AnnounceQueryExt (..)
64 , renderAnnounceQueryExt
65 , parseAnnounceQueryExt
66
67 , AnnounceRequest (..)
68 , parseAnnounceRequest
69 , renderAnnounceRequest
70
71 -- ** Response
69 , announceType 72 , announceType
70 , scrapeType 73 , scrapeType
71 , parseFailureStatus 74 , parseFailureStatus
@@ -113,14 +116,20 @@ import Network.BitTorrent.Core
113-- Events 116-- Events
114-----------------------------------------------------------------------} 117-----------------------------------------------------------------------}
115 118
116-- | Events used to specify which kind of announce query is performed. 119-- | Events are used to specify which kind of announce query is performed.
117data Event = Started 120data Event
118 -- ^ For the first request: when a peer join the swarm. 121 -- | For the first request: when download first begins.
119 | Stopped 122 = Started
120 -- ^ Sent when the peer is shutting down. 123
121 | Completed 124 -- | This peer stopped downloading /and/ uploading the torrent or
122 -- ^ To be sent when the peer completes a download. 125 -- just shutting down.
123 deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable) 126 | Stopped
127
128 -- | This peer completed downloading the torrent. This only happen
129 -- right after last piece have been verified. No 'Completed' is
130 -- sent if the file was completed when 'Started'.
131 | Completed
132 deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)
124 133
125$(deriveJSON omitRecordPrefix ''Event) 134$(deriveJSON omitRecordPrefix ''Event)
126 135
@@ -186,11 +195,13 @@ data AnnounceQuery = AnnounceQuery
186 -- tracker throught a proxy. 195 -- tracker throught a proxy.
187 , reqIP :: Maybe HostAddress 196 , reqIP :: Maybe HostAddress
188 197
189 -- | Number of peers that the peers wants to receive from. See 198 -- | Number of peers that the peers wants to receive from. It is
190 -- note for 'defaultNumWant'. 199 -- optional for trackers to honor this limit. See note for
200 -- 'defaultNumWant'.
191 , reqNumWant :: Maybe Int 201 , reqNumWant :: Maybe Int
192 202
193 -- | If not specified, the request is regular periodic request. 203 -- | If not specified, the request is regular periodic
204 -- request. Regular request should be sent
194 , reqEvent :: Maybe Event 205 , reqEvent :: Maybe Event
195 } deriving (Show, Eq, Typeable) 206 } deriving (Show, Eq, Typeable)
196 207
@@ -621,12 +632,12 @@ defaultMaxNumWant = 200
621defaultReannounceInterval :: Int 632defaultReannounceInterval :: Int
622defaultReannounceInterval = 30 * 60 633defaultReannounceInterval = 30 * 60
623 634
624type RawPath = BS.ByteString 635type PathPiece = BS.ByteString
625 636
626defaultAnnouncePath :: RawPath 637defaultAnnouncePath :: PathPiece
627defaultAnnouncePath = "announce" 638defaultAnnouncePath = "announce"
628 639
629defaultScrapePath :: RawPath 640defaultScrapePath :: PathPiece
630defaultScrapePath = "scrape" 641defaultScrapePath = "scrape"
631 642
632missingOffset :: Int 643missingOffset :: Int