From 6ff528851f77b46f549db2bd4c6ba7d99d6b828f Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Fri, 28 Feb 2014 19:24:42 +0400 Subject: optMinTimeout should be in seconds, not in useconds --- src/Network/BitTorrent/Tracker/RPC/UDP.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Network/BitTorrent/Tracker/RPC/UDP.hs') 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 -- | See defMinTimeout :: Int -defMinTimeout = 15 * sec +defMinTimeout = 15 -- | See defMaxTimeout :: Int -defMaxTimeout = 15 * 2 ^ (8 :: Int) * sec +defMaxTimeout = 15 * 2 ^ (8 :: Int) -- | See: defMultiplier :: Int @@ -90,18 +90,18 @@ data Options = Options -- 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 + -- | Starting timeout interval in seconds. 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 - -- | After 'optMaxTimeout' reached and tracker still not - -- responding both 'announce' and 'scrape' functions will throw - -- 'TimeoutExpired' exception. + -- | Final timeout interval 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'. -- @@ -574,7 +574,7 @@ retransmission Options {..} action = go optMinTimeout go curTimeout | curTimeout > optMaxTimeout = throwIO $ TimeoutExpired curTimeout | otherwise = do - r <- timeout curTimeout action + r <- timeout (curTimeout * sec) action maybe (go (optMultiplier * curTimeout)) return r queryTracker :: Manager -> URI -> Request -> IO Response -- cgit v1.2.3