summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/Session.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-19 01:45:12 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-19 01:45:12 +0400
commit81b71a4a9f0a6f9fd64de08d2dd22303b169a076 (patch)
tree5e364431594649ab2376006f1174b2fddceffc3b /src/Network/BitTorrent/DHT/Session.hs
parent879074f286a602848d3edff10de36e88a9622cbc (diff)
Return Bool instead of raising exception in checkToken
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index 6f13cf78..10f3e9e4 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -349,12 +349,11 @@ grantToken addr = do
349 349
350-- | Throws 'HandlerError' if the token is invalid or already 350-- | Throws 'HandlerError' if the token is invalid or already
351-- expired. See 'TokenMap' for details. 351-- expired. See 'TokenMap' for details.
352checkToken :: Hashable a => NodeAddr a -> Token -> DHT ip () 352checkToken :: Hashable a => NodeAddr a -> Token -> DHT ip Bool
353checkToken addr questionableToken = do 353checkToken addr questionableToken = do
354 tryUpdateSecret 354 tryUpdateSecret
355 toks <- asks sessionTokens >>= liftIO . readTVarIO 355 toks <- asks sessionTokens >>= liftIO . readTVarIO
356 unless (T.member addr questionableToken (tokenMap toks)) $ 356 return $ T.member addr questionableToken (tokenMap toks)
357 throwIO $ InvalidParameter "token"
358 357
359{----------------------------------------------------------------------- 358{-----------------------------------------------------------------------
360-- Routing table 359-- Routing table