koi_net.components.error_handler

Classes

ErrorHandler(log, kobj_queue, handshaker)

Handles network and protocol errors that may occur during requests.

class koi_net.components.error_handler.ErrorHandler(log, kobj_queue, handshaker)[source]

Bases: object

Handles network and protocol errors that may occur during requests.

Parameters:
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:
handshaker: Handshaker
kobj_queue: KobjQueue
log: Logger
reset_timeout_counter(node)[source]

Reset’s a node timeout counter to zero.

Parameters:

node (KoiNetNode)

timeout_counter: dict[KoiNetNode, int]