-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Wait for all notifications protocols to be open before reporting opening #6821
Conversation
Err... the |
bot rebase |
Rebasing. |
Did the burnin on my node. Nothing unusual or suspicious happened. |
I've rebased the PR over #6826, which I expect to fix the test. |
Co-authored-by: Max Inden <mail@max-inden.de>
At the end, isn't it desirable to report the notification protocols as open/closed individually and independently of each other? Such that the user of the API doesn't even know whether a notification protocol is implemented as a substream or connection. It shouldn't be necessary to have the notion of "reporting a connection open/closed" on the API, should it? (I didn't look at the diff yet but wanted to do that now). |
It's indeed the objective. There are unfortunately some questions concerning the handshake. |
To be clear: the public-facing API of All the uncertainties and potential refactoring only concerns the internals of sc-network. |
The tricky part of this PR is that we can now be in an "intermediate stage" where some substreams are open, but we haven't notified the upper layers of it yet. It is important, in this situation, to not poll the open substreams for incoming notifications until we have notified the upper layers, otherwise we have no choice but to discard these incoming notifications. This is the reason why the tests were failing earlier, and should now be fixed. |
Co-authored-by: Max Inden <mail@max-inden.de>
For what it is worth |
This is the next step towards #5670
Before this PR:
After this PR:
While this change is quite small, it eliminates the possibility of using the legacy substream for notifications with a remote that does support notifications substreams.
The next step, after this PR, would be to report the connection on the API level after all the notifications substreams have been either opened or refused, no matter whether the legacy substream is open. Then, afterwards, to no longer open a legacy substream.