From b4dedc225b719b58505eed20039680d21c3334e7 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Wed, 26 Feb 2014 17:33:32 +0400 Subject: Document udp tracker options --- src/Network/BitTorrent/Tracker/RPC/UDP.hs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/Network/BitTorrent') 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 defMultiplier :: Int defMultiplier = 2 --- announce request packet defMaxPacketSize :: Int defMaxPacketSize = 98 +-- | Manager configuration. data Options = Options - { optMaxPacketSize :: {-# UNPACK #-} !Int - - -- | in seconds. + { -- | Max size of a /response/ packet. + -- + -- 'optMaxPacketSize' /must/ be a positive value. + -- + optMaxPacketSize :: {-# UNPACK #-} !Int + + -- | Starting timeout interval. If a response is not received + -- after 'optMinTimeout' then 'Manager' repeat RPC with timeout + -- interval multiplied by 'optMultiplier' and so on until + -- timeout interval reach 'optMaxTimeout'. + -- + -- 'optMinTimeout' /must/ be a positive value. + -- , optMinTimeout :: {-# UNPACK #-} !Int - -- | in seconds. + -- | After 'optMaxTimeout' reached and tracker still not + -- responding both 'announce' and 'scrape' functions will throw + -- 'TimeoutExpired' exception. + -- + -- 'optMaxTimeout' /must/ be greater than 'optMinTimeout'. + -- , optMaxTimeout :: {-# UNPACK #-} !Int + -- | 'optMultiplier' must a positive value. , optMultiplier :: {-# UNPACK #-} !Int } deriving (Show, Eq) +-- | Options suitable for bittorrent client. instance Default Options where def = Options { optMaxPacketSize = defMaxPacketSize -- cgit v1.2.3