summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/Tracker/RPC/UDP.hs8
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/UDP.hs b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
index 24e96238..31b6b870 100644
--- a/src/Network/BitTorrent/Tracker/RPC/UDP.hs
+++ b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
@@ -123,10 +123,14 @@ checkOptions Options {..} = do
123 throwIO $ userError "optMinTimeout must be positive" 123 throwIO $ userError "optMinTimeout must be positive"
124 124
125 unless (optMaxTimeout > 0) $ do 125 unless (optMaxTimeout > 0) $ do
126 throwIO $ userError "optMaxTimeout must be positive"
127
128 unless (optMultiplier > 0) $ do
129 throwIO $ userError "optMultiplier must be positive"
130
131 unless (optMaxTimeout > optMinTimeout) $ do
126 throwIO $ userError "optMaxTimeout must be greater than optMinTimeout" 132 throwIO $ userError "optMaxTimeout must be greater than optMinTimeout"
127 133
128 unless (optMinTimeout > 0) $ do
129 throwIO $ userError "optMinTimeout must be positive"
130 134
131{----------------------------------------------------------------------- 135{-----------------------------------------------------------------------
132-- Manager state 136-- Manager state
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
index 1ec3bdb7..3a3dddf5 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
@@ -67,7 +67,7 @@ spec = parallel $ do
67 let opts = def { optMinTimeout = 2, optMaxTimeout = 1 } 67 let opts = def { optMinTimeout = 2, optMaxTimeout = 1 }
68 newManager opts `shouldThrow` isSomeException 68 newManager opts `shouldThrow` isSomeException
69 69
70 it "should throw exception on optMultiplier" $ do 70 it "should throw exception on zero optMultiplier" $ do
71 let opts = def { optMultiplier = 0 } 71 let opts = def { optMultiplier = 0 }
72 newManager opts `shouldThrow` isSomeException 72 newManager opts `shouldThrow` isSomeException
73 73
@@ -141,4 +141,4 @@ spec = parallel $ do
141 it "should handle arbitrary intermixed concurrent queries" $ do 141 it "should handle arbitrary intermixed concurrent queries" $ do
142 withManager rpcOpts $ \ mgr -> do 142 withManager rpcOpts $ \ mgr -> do
143 _ <- mapConcurrently (\ _ -> scrape mgr trackerURI [def]) [1..rpcCount] 143 _ <- mapConcurrently (\ _ -> scrape mgr trackerURI [def]) [1..rpcCount]
144 return () \ No newline at end of file 144 return ()