diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 17:33:32 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 17:33:32 +0400 |
commit | b4dedc225b719b58505eed20039680d21c3334e7 (patch) | |
tree | 28892d12fb5930b3fb9e3af41a83801f7433fb1b /src/Network/BitTorrent/Tracker/RPC/UDP.hs | |
parent | fa01c6b1b3918b5dc68933ad18a7ce930788338b (diff) |
Document udp tracker options
Diffstat (limited to 'src/Network/BitTorrent/Tracker/RPC/UDP.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker/RPC/UDP.hs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/UDP.hs b/src/Network/BitTorrent/Tracker/RPC/UDP.hs index db9c32b3..76188eaf 100644 --- a/src/Network/BitTorrent/Tracker/RPC/UDP.hs +++ b/src/Network/BitTorrent/Tracker/RPC/UDP.hs | |||
@@ -72,22 +72,39 @@ defMaxTimeout = 15 * 2 ^ (8 :: Int) * sec | |||
72 | defMultiplier :: Int | 72 | defMultiplier :: Int |
73 | defMultiplier = 2 | 73 | defMultiplier = 2 |
74 | 74 | ||
75 | -- announce request packet | ||
76 | defMaxPacketSize :: Int | 75 | defMaxPacketSize :: Int |
77 | defMaxPacketSize = 98 | 76 | defMaxPacketSize = 98 |
78 | 77 | ||
78 | -- | Manager configuration. | ||
79 | data Options = Options | 79 | data Options = Options |
80 | { optMaxPacketSize :: {-# UNPACK #-} !Int | 80 | { -- | Max size of a /response/ packet. |
81 | 81 | -- | |
82 | -- | in seconds. | 82 | -- 'optMaxPacketSize' /must/ be a positive value. |
83 | -- | ||
84 | optMaxPacketSize :: {-# UNPACK #-} !Int | ||
85 | |||
86 | -- | Starting timeout interval. If a response is not received | ||
87 | -- after 'optMinTimeout' then 'Manager' repeat RPC with timeout | ||
88 | -- interval multiplied by 'optMultiplier' and so on until | ||
89 | -- timeout interval reach 'optMaxTimeout'. | ||
90 | -- | ||
91 | -- 'optMinTimeout' /must/ be a positive value. | ||
92 | -- | ||
83 | , optMinTimeout :: {-# UNPACK #-} !Int | 93 | , optMinTimeout :: {-# UNPACK #-} !Int |
84 | 94 | ||
85 | -- | in seconds. | 95 | -- | After 'optMaxTimeout' reached and tracker still not |
96 | -- responding both 'announce' and 'scrape' functions will throw | ||
97 | -- 'TimeoutExpired' exception. | ||
98 | -- | ||
99 | -- 'optMaxTimeout' /must/ be greater than 'optMinTimeout'. | ||
100 | -- | ||
86 | , optMaxTimeout :: {-# UNPACK #-} !Int | 101 | , optMaxTimeout :: {-# UNPACK #-} !Int |
87 | 102 | ||
103 | -- | 'optMultiplier' must a positive value. | ||
88 | , optMultiplier :: {-# UNPACK #-} !Int | 104 | , optMultiplier :: {-# UNPACK #-} !Int |
89 | } deriving (Show, Eq) | 105 | } deriving (Show, Eq) |
90 | 106 | ||
107 | -- | Options suitable for bittorrent client. | ||
91 | instance Default Options where | 108 | instance Default Options where |
92 | def = Options | 109 | def = Options |
93 | { optMaxPacketSize = defMaxPacketSize | 110 | { optMaxPacketSize = defMaxPacketSize |