summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-08 07:01:19 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-08 07:01:19 +0400
commit73ce8f14a938326975050691042b93ad5eedca66 (patch)
tree88fb011574b3bde3e588c7e634ec49c5ff42cfd7 /src/Network
parent1fb619d9d5edc1c352e2b72cbf5dfcf5c64d05ff (diff)
Add some options TODOs
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/KRPC/Manager.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Network/KRPC/Manager.hs b/src/Network/KRPC/Manager.hs
index e2b60b6a..22bfe477 100644
--- a/src/Network/KRPC/Manager.hs
+++ b/src/Network/KRPC/Manager.hs
@@ -202,6 +202,7 @@ withManager opts addr hs = bracket (newManager opts addr hs) closeManager
202-- Logging 202-- Logging
203-----------------------------------------------------------------------} 203-----------------------------------------------------------------------}
204 204
205-- TODO prettify log messages
205querySignature :: MethodName -> TransactionId -> SockAddr -> Text 206querySignature :: MethodName -> TransactionId -> SockAddr -> Text
206querySignature name transaction addr = T.concat 207querySignature name transaction addr = T.concat
207 [ "&", T.decodeUtf8 name 208 [ "&", T.decodeUtf8 name
@@ -311,10 +312,12 @@ query addr params = do
311-- 312--
312-- * ErrorCode(MethodUnknown) in the 'dispatchHandler'; 313-- * ErrorCode(MethodUnknown) in the 'dispatchHandler';
313-- 314--
314-- * ErrorCode(ServerError) in the 'runHandler'; (those can be 315-- * ErrorCode(ServerError) in the 'runHandler';
316--
317-- * ErrorCode(GenericError) in the 'runHandler' (those can be
315-- async exception too) 318-- async exception too)
316-- 319--
317-- * ErrorCode(GenericError) on 320-- so HandlerFailure should cover *only* 'ProtocolError's.
318 321
319-- | Used to signal protocol errors. 322-- | Used to signal protocol errors.
320data HandlerFailure 323data HandlerFailure
@@ -396,6 +399,13 @@ dispatchHandler q @ KQuery {..} addr = do
396-- Listener 399-- Listener
397-----------------------------------------------------------------------} 400-----------------------------------------------------------------------}
398 401
402-- TODO bound amount of parallel handler *threads*:
403--
404-- peer A flooding with find_node
405-- peer B trying to ping peer C
406-- peer B fork too many threads
407-- ... space leak
408--
399handleQuery :: MonadKRPC h m => KQuery -> SockAddr -> m () 409handleQuery :: MonadKRPC h m => KQuery -> SockAddr -> m ()
400handleQuery q addr = void $ fork $ do 410handleQuery q addr = void $ fork $ do
401 Manager {..} <- getManager 411 Manager {..} <- getManager