fn tie_break_existing_connection(&self, existing_conn: &PeerConnection, new_conn: &PeerConnection) -> bool {
        debug_assert_eq!(existing_conn.peer_node_id(), new_conn.peer_node_id());
        let peer_node_id = existing_conn.peer_node_id();
        let our_node_id = self.node_identity.node_id();

        debug!(
            target: LOG_TARGET,
            "Tie-break: (Existing = {}, New = {})",
            existing_conn.direction(),
            new_conn.direction()
        );
        use ConnectionDirection::*;
        match (existing_conn.direction(), new_conn.direction()) {
            // They connected to us twice for some reason. Drop the older connection
            (Inbound, Inbound) => true,
            // They connected to us at the same time we connected to them
            (Inbound, Outbound) => peer_node_id > our_node_id,
            // We connected to them at the same time as they connected to us
            (Outbound, Inbound) => our_node_id > peer_node_id,
            // We connected to them twice for some reason. Drop the newer connection.
            (Outbound, Outbound) => false,
        }
    }
/// Two connections to the same peer have been created. This function deterministically determines which peer
/// connection to close. It does this by comparing our NodeId to that of the peer. This rule enables both sides to
/// agree which connection to disconnect
///
/// Returns true if the existing connection should close, otherwise false if the new connection should be closed.
Two connections to the same peer have been created. This function deterministically determines which peer
connection to close. It does this by comparing our NodeId to that of the peer. This rule enables both sides to
agree which connection to disconnect

Returns true if the existing connection should close, otherwise false if the new connection should be closed.
Two connections to the same peer have been created . This function deterministically determines which peer connection to close . It does this by comparing our NodeId to that of the peer . This rule enables both sides to agree which connection to disconnect Returns true if the existing connection should close otherwise false if the new connection should be closed .
fn tie_break_existing_connection(&self, existing_conn: &PeerConnection, new_conn: &PeerConnection) -> bool {
        debug_assert_eq!(existing_conn.peer_node_id(), new_conn.peer_node_id());
        let peer_node_id = existing_conn.peer_node_id();
        let our_node_id = self.node_identity.node_id();
        debug!(
            target: LOG_TARGET,
            "Tie-break: (Existing = {}, New = {})",
            existing_conn.direction(),
            new_conn.direction()
        );
        use ConnectionDirection::*;
        match (existing_conn.direction(), new_conn.direction()) {
            // They connected to us twice for some reason. Drop the older connection
            (Inbound, Inbound) => true,
            // They connected to us at the same time we connected to them
            (Inbound, Outbound) => peer_node_id > our_node_id,
            // We connected to them at the same time as they connected to us
            (Outbound, Inbound) => our_node_id > peer_node_id,
            // We connected to them twice for some reason. Drop the newer connection.
            (Outbound, Outbound) => false,
        }
    }
fn tie_break_existing_connection ( & self , existing_conn : & PeerConnection , new_conn : & PeerConnection ) -> bool { debug_assert_eq ! ( existing_conn peer_node_id ( ) new_conn peer_node_id ( ) ) ; let peer_node_id = existing_conn . peer_node_id ( ) ; let our_node_id = self . node_identity . node_id ( ) ; debug ! ( target LOG_TARGET " " existing_conn direction ( ) new_conn direction ( ) ) ; use ConnectionDirection :: * ; match ( existing_conn . direction ( ) , new_conn . direction ( ) ) { // They connected to us twice for some reason. Drop the older connection ( Inbound , Inbound ) => true , // They connected to us at the same time we connected to them ( Inbound , Outbound ) => peer_node_id > our_node_id , // We connected to them at the same time as they connected to us ( Outbound , Inbound ) => our_node_id > peer_node_id , // We connected to them twice for some reason. Drop the newer connection. ( Outbound , Outbound ) => false , } }
Two connections to the same peer have been created.
Two connections to the same peer have been created .
&self
existing_conn
&PeerConnection
new_conn
&PeerConnection
&self
existing_conn
&PeerConnection
new_conn
&PeerConnection