Thresholds for disconnect detection and removal from connection list

Peernet shall be a high-performance network. If connections are dead, it is better for the network health if they are detected early on, that way a peer can make more well informed decisions (such as using different connections to the same peer, or talking to other peers).

On the other hand we obviously have to consider network overhead. If someone has a low latency internet connection, high packet loss, or slow speed, we don't want to end up clogging the pipe with overhead. In the latest commit I already made smart choices such as using the ping/pong check only if there was not already a different packet received recently from that peer on that particular connection.

Connections are first moved to the inactive list, and then removed entirely, based on the below thresholds. Any thoughts @wesl_ee ?

// pingTime is the time in seconds to send out ping messages
const pingTime = 10


// connectionInvalidate is the threshold in seconds to invalidate formerly active connections that no longer receive incoming packets.
const connectionInvalidate = 20


// connectionRemove is the threshold in seconds to remove inactive connections in case there is at least one active connection known.
const connectionRemove = 2 * 60
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!