Skip to main content

new_conn_wins

Function new_conn_wins 

Source
fn new_conn_wins(
    own: &PeerID,
    remote: &PeerID,
    old: &ConnDirection,
    new: &ConnDirection,
) -> bool
Expand description

Decides whether a new connection to a peer replaces the one already in the pool. When two nodes dial each other at the same time, each sees both connections in opposite directions. Both keep the one dialed by the node with the smaller PeerID, so they keep the same connection. Two connections in the same direction keep the first.