Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[multistream] Make the lazy variant more interoperable. #1855
[multistream] Make the lazy variant more interoperable. #1855
Changes from 2 commits
229e470
3fabe47
70f041b
b1ea9ed
dedf5ce
b11a4a4
f32ce53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The fact that we assume that
version
can never beV1Lazy
looks a bit like a hack to me.In an ideal world, we would differentiate the
Version
enum (containingV1
andV1Lazy
) from theVersionHandshake
(containing onlyV1
), no?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.
By definition of these versions, they're now indistinguishable on the wire and it is always expected to receive
V1
. So receivingV1Lazy
is considered an error (in the decoder really).Since
V1Lazy
is now really the same negotiation protocol asV1
, only differing subtly in the behaviour of the dialer, it may be cleaner to separate this "lazy flush yes/no" setting from theVersion
, making it a separate configuration option for the dialer only, sinceV1Lazy
used for a listener now has no effect at all. However, for transport and substream upgrades we currently only have this choice ofVersion
without a concept of separate parameters for the roles of dialer and/or listener. MaybeVersion::V1 { dialer_lazy_flush: bool }
would already be an improvement, though be another API change. It would always be decoded from the wire withdialer_lazy_flush: false
since that option is local. Should I give that a try? So due to the fact that this would require larger API changes, together with my hope thatV1Lazy
will eventually disappear altogether, merging its behaviour intoV1
, led me to the current approach, but I'm open to alternatives.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.
What I had in mind is that you wouldn't decode a
Version
, but a new enum called for exampleVersionHandshake
that would only containV1
without any parameter.I don't know if that makes sense, and I'm also not strongly opinionated. I'm fine with these changes.
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 see, separating these two kinds of versions. I will give that a try.
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.
My proposal is 70f041b.
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.
Let me know if I understand correctly:
If I create a protocol named
/foo
and the first message sent after opening a/foo
substream is/bar\nhello world
, then, if the listener doesn't support protocol/foo
, it will misinterpret the payload as the dialer opening the protocol/bar
and sendinghello world
.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.
Yes, see multiformats/go-multistream#20 for more details (that link is also in the code).