-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix the dialing priority system #907
Conversation
core/src/nodes/raw_swarm.rs
Outdated
// knowing. It is possible that the remote has already closed its ougoing attempt because | ||
// it sees our outgoing attempt as a success. | ||
// However we cancel any further multiaddress to attempt. | ||
// TODO: cancel if we don't have dial priority? we should write tests first |
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.
I think it is critical to do this as well; otherwise our dialing attempt will always replace the remote's connection, regardless of whether we have priority.
dd8e559
to
94ad788
Compare
b769969
to
dc406b6
Compare
The test I added fails on master. EDIT: Actually no; I'm having a hard time writing a test that fails on master. |
Oh well, let's merge this. |
Fixes maybe #883, I'm not sure.
Right now, when we dial a node and receive an incoming connection from that same node, we cancel the outgoing attempt.
The problem is that this outgoing attempt may have already succeeded (and we don't know yet), in which case the remote has maybe cancelled its own connection. The outcome is no connection at all.
There is a dialing priority system in place, but it applied only if we receive a new connection from a node we are already connected to.
This PR does the following:
DialError
events from nodes we are connected to. In order to clarify this, I changed theremaining_addresses
field (indicating the number of addresses in queue) into anew_state
field that indicates the state of the peer.