-
Notifications
You must be signed in to change notification settings - Fork 445
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: opt-in to toplogy notifications on transient connections #2049
fix: opt-in to toplogy notifications on transient connections #2049
Conversation
Adds a `notifyOnTransient` option when registering a network topology to opt-in to being notified when peers that support the registered protocol connect over transient connections. False by default. The logic has been switched to notify after identify has completed rather than after the first connection for a peer has been opened. The side effect here is that if `notifyOnTransient` is true, and the peer ends up opening a direct connection (for example they dial us via circuit relay, open a stream to do the WebRTC SDP exchange, then open a WebRTC connection), identify will run on the second connection so the topology will receive two notificiations. This is not a breaking change since the previous behaviour would have been to only notify on the transient connection, which is probably a bug as you can't do data-heavy things like bitswap over transient connections so is undesirable. Fixes #2036
1aec17d
to
0cbd823
Compare
…nsient-connections
…nsient-connections
…nsient-connections
…nsient-connections
Still needs a bit of work, it's missing the case where a peer opens a transient connection, then opens a second non-transient connection. |
Dismissing approval given with the new changes there is remaining work to get the topology to correctly notify for transient connections as well as direct connections
Hate to nag but is there an ETA on this? GossipSub over WebRTC is completely broken so this is blocking new releases for us 😖 |
…gy-notifications-on-transient-connections
I've added a test for this. The topology will get a notification on each connection that is opened and it'll be down the implementation to not duplicate peer operations, etc. It'll only be notified on transient connections if it ops in to notifications, otherwise it'll just get them for non-transient connections. |
I've been testing this branch locally and I think there's still something missing. Currently, the registrar only notifies topologies of new connections from within the The problem with this is with the protocol diff / filtering at the beginning. For example, when I try to use GossipSub over WebRTC in the browser, the following happens:
|
I don't think there's a straightforward one- or two-line fix for this. I have a patch joeltg@bef1927 that adds a I seem to remember that |
…gy-notifications-on-transient-connections
…nsient-connections
8436693
to
b2f8d0d
Compare
I've updated the PR to only do the peer disconnect notifications when protocols are removed on This is a little easier to reason about as well I think. |
Awesome, this works locally for me! Thanks so much |
Adds a
notifyOnTransient
option when registering a network topology to opt-in to being notified when peers that support the registered protocol connect over transient connections. False by default.The logic has been switched to check each connection's transient property and only notify if the user has opted in.
The side effect here is that if
notifyOnTransient
is true, and the peer ends up opening a direct connection (for example they dial us via circuit relay, open a stream to do the WebRTC SDP exchange, then open a WebRTC connection), identify will run on the second connection so the topology will receive two notifications.This is not a breaking change since the previous behaviour would have been to only notify on the initial transient connection, which you can't do data-heavy things like bitswap over, or long-lived things like GossipSub so is probably a bug.
Fixes #2036