You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then existing connection gets dropped and only incoming connection remains.
If two peers try to establish connection to each other simultaneously, this is what happens. First, node establishes outgoing connection. Then it gets incoming connection and closes its outgoing connection because send_rx got closed. At this point "connection closed without error" is printed.
Because this happens on the other side, the other side also closes its outgoing connection. For the first peer it is incoming connection. When it detects that incoming connection got closed, it logs
iroh_gossip::net: connection closed with error connection lost
Caused by:
closed by peer: 0
Then both sides have no connection anymore.
Not accepting incoming connection does not work either, then we have two outgoing connection and don't listen on the incoming ones. I think we should just keep incoming connection even if it is replaced (send_tx gets dropped) until it is closed by the other side, e.g. because it leaves gossip explicitly.
Here if we get incoming connection and already have a connection with the same peer, old connection is dropped:
iroh/iroh-gossip/src/net.rs
Line 425 in 370075c
This is fine because connection is just a reference and it got cloned into
connection_loop
already.But here we create new
send_tx
and evict existing one from the map:iroh/iroh-gossip/src/net.rs
Line 428 in 370075c
Previously started connection loop detects that its
send_rx
side got closed and breaks:iroh/iroh-gossip/src/net.rs
Line 620 in 370075c
Then existing connection gets dropped and only incoming connection remains.
If two peers try to establish connection to each other simultaneously, this is what happens. First, node establishes outgoing connection. Then it gets incoming connection and closes its outgoing connection because
send_rx
got closed. At this point "connection closed without error" is printed.Because this happens on the other side, the other side also closes its outgoing connection. For the first peer it is incoming connection. When it detects that incoming connection got closed, it logs
Then both sides have no connection anymore.
Not accepting incoming connection does not work either, then we have two outgoing connection and don't listen on the incoming ones. I think we should just keep incoming connection even if it is replaced (
send_tx
gets dropped) until it is closed by the other side, e.g. because it leaves gossip explicitly.This is my analysis of what happens in deltachat/deltachat-core-rust#5595
The text was updated successfully, but these errors were encountered: