diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-08 07:01:19 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-08 07:01:19 +0400 |
commit | 73ce8f14a938326975050691042b93ad5eedca66 (patch) | |
tree | 88fb011574b3bde3e588c7e634ec49c5ff42cfd7 /src/Network | |
parent | 1fb619d9d5edc1c352e2b72cbf5dfcf5c64d05ff (diff) |
Add some options TODOs
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/KRPC/Manager.hs | 14 |
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 | ||
205 | querySignature :: MethodName -> TransactionId -> SockAddr -> Text | 206 | querySignature :: MethodName -> TransactionId -> SockAddr -> Text |
206 | querySignature name transaction addr = T.concat | 207 | querySignature 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. |
320 | data HandlerFailure | 323 | data 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 | -- | ||
399 | handleQuery :: MonadKRPC h m => KQuery -> SockAddr -> m () | 409 | handleQuery :: MonadKRPC h m => KQuery -> SockAddr -> m () |
400 | handleQuery q addr = void $ fork $ do | 410 | handleQuery q addr = void $ fork $ do |
401 | Manager {..} <- getManager | 411 | Manager {..} <- getManager |