koi_net.components.error_handler
Classes
|
Handles network and protocol errors that may occur during requests. |
- class koi_net.components.error_handler.ErrorHandler(log, kobj_queue, handshaker)[source]
Bases:
objectHandles network and protocol errors that may occur during requests.
- Parameters:
log (Logger)
kobj_queue (KobjQueue)
handshaker (Handshaker)
- handle_connection_error(node)[source]
Drops nodes after timing out three times.
TODO: Need a better heuristic for network state. For example, if a node lost connection to the internet, it would quickly forget all other nodes.
- Parameters:
node (KoiNetNode)
- handle_protocol_error(error_type, node)[source]
Handles protocol errors that occur during network requests.
Attempts handshake when this node is unknown to target.
- Parameters:
error_type (ErrorType)
node (KoiNetNode)
- handshaker: Handshaker
- log: Logger
- reset_timeout_counter(node)[source]
Reset’s a node timeout counter to zero.
- Parameters:
node (KoiNetNode)
- timeout_counter: dict[KoiNetNode, int]