-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: avoid duplicate autoconnection attempt #1742
base: main
Are you sure you want to change the base?
feat: avoid duplicate autoconnection attempt #1742
Conversation
Gossip autoconnection could result in two nodes attempting to connect to each other concurrently. To fix this issue, only one node initiate the connection now. The selection criteria is arbitrary but deterministic, currently the greater zid of both.
if !self.autoconnect.is_empty() | ||
&& self.autoconnect.matches(whatami) | ||
&& select_autoconnect_node(self.graph[self.idx].zid, zid) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a more complex problem than what it seems. Consider the following:
- Node1 is a peer, it is setup to autoconnect to routers and peers.
- Node2 is a router, it is setup to autoconnect only to routers.
- Node2 has a higher ZID, and therefore is the one returned by
select_autoconnect_node
.
In thise case, Node1 will not attempt to connect because it is not the selected node, and Node2 will not autoconnect because it does not have peers in its autoconnect config, and the connection will never be established...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we add autoconnect config to the exchanged gossip information, the other solutions may involve closing one of the two links during or after opening the transport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typos and missing comments
Co-authored-by: Oussama Teffahi <[email protected]>
Co-authored-by: Oussama Teffahi <[email protected]>
Co-authored-by: Oussama Teffahi <[email protected]>
Gossip autoconnection could result in two nodes attempting to connect to each other concurrently.
To fix this issue, only one node initiate the connection now. The selection criteria is arbitrary but deterministic, currently the greater zid of both.