summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/Tracker/RPC/UDP.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/UDP.hs b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
index 48732b9b..0c9c3367 100644
--- a/src/Network/BitTorrent/Tracker/RPC/UDP.hs
+++ b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
@@ -68,11 +68,11 @@ sec = 1000000
68 68
69-- | See <http://www.bittorrent.org/beps/bep_0015.html#time-outs> 69-- | See <http://www.bittorrent.org/beps/bep_0015.html#time-outs>
70defMinTimeout :: Int 70defMinTimeout :: Int
71defMinTimeout = 15 * sec 71defMinTimeout = 15
72 72
73-- | See <http://www.bittorrent.org/beps/bep_0015.html#time-outs> 73-- | See <http://www.bittorrent.org/beps/bep_0015.html#time-outs>
74defMaxTimeout :: Int 74defMaxTimeout :: Int
75defMaxTimeout = 15 * 2 ^ (8 :: Int) * sec 75defMaxTimeout = 15 * 2 ^ (8 :: Int)
76 76
77-- | See: <http://www.bittorrent.org/beps/bep_0015.html#time-outs> 77-- | See: <http://www.bittorrent.org/beps/bep_0015.html#time-outs>
78defMultiplier :: Int 78defMultiplier :: Int
@@ -90,18 +90,18 @@ data Options = Options
90 -- 90 --
91 optMaxPacketSize :: {-# UNPACK #-} !Int 91 optMaxPacketSize :: {-# UNPACK #-} !Int
92 92
93 -- | Starting timeout interval. If a response is not received 93 -- | Starting timeout interval in seconds. If a response is not
94 -- after 'optMinTimeout' then 'Manager' repeat RPC with timeout 94 -- received after 'optMinTimeout' then 'Manager' repeat RPC with
95 -- interval multiplied by 'optMultiplier' and so on until 95 -- timeout interval multiplied by 'optMultiplier' and so on until
96 -- timeout interval reach 'optMaxTimeout'. 96 -- timeout interval reach 'optMaxTimeout'.
97 -- 97 --
98 -- 'optMinTimeout' /must/ be a positive value. 98 -- 'optMinTimeout' /must/ be a positive value.
99 -- 99 --
100 , optMinTimeout :: {-# UNPACK #-} !Int 100 , optMinTimeout :: {-# UNPACK #-} !Int
101 101
102 -- | After 'optMaxTimeout' reached and tracker still not 102 -- | Final timeout interval in seconds. After 'optMaxTimeout'
103 -- responding both 'announce' and 'scrape' functions will throw 103 -- reached and tracker still not responding both 'announce' and
104 -- 'TimeoutExpired' exception. 104 -- 'scrape' functions will throw 'TimeoutExpired' exception.
105 -- 105 --
106 -- 'optMaxTimeout' /must/ be greater than 'optMinTimeout'. 106 -- 'optMaxTimeout' /must/ be greater than 'optMinTimeout'.
107 -- 107 --
@@ -574,7 +574,7 @@ retransmission Options {..} action = go optMinTimeout
574 go curTimeout 574 go curTimeout
575 | curTimeout > optMaxTimeout = throwIO $ TimeoutExpired curTimeout 575 | curTimeout > optMaxTimeout = throwIO $ TimeoutExpired curTimeout
576 | otherwise = do 576 | otherwise = do
577 r <- timeout curTimeout action 577 r <- timeout (curTimeout * sec) action
578 maybe (go (optMultiplier * curTimeout)) return r 578 maybe (go (optMultiplier * curTimeout)) return r
579 579
580queryTracker :: Manager -> URI -> Request -> IO Response 580queryTracker :: Manager -> URI -> Request -> IO Response