-
Notifications
You must be signed in to change notification settings - Fork 52
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(yamux): set EoF when remote peer half closes the stream in yamux #1086
Conversation
caf4625
to
f8a27a2
Compare
f8a27a2
to
760cb78
Compare
This reverts commit f1c39bd.
4f8c486
to
8cdc5a1
Compare
libp2p/muxers/yamux/yamux.nim
Outdated
@@ -442,7 +441,7 @@ proc cleanupChannel(m: Yamux, channel: YamuxChannel) {.async: (raises: []).} = | |||
when defined(libp2p_yamux_metrics): | |||
libp2p_yamux_channels.set( | |||
m.lenBySrc(channel.isSrc).int64, [$channel.isSrc, $channel.peerId]) | |||
if channel.isReset and channel.recvWindow > 0: | |||
if (channel.isReset or not channel.closedRemotely.completed()) and channel.recvWindow > 0: |
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'm not sure about this new condition.
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.
channel.closedRemotely
is always completed after channel.join()
.
In theory, the only possible case is if we try to cancel, but cleanupChannel
is async spawned, so we cannot cancel it.
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.
channel.closedRemotely is always completed after channel.join().
Is it? remoteClosed
is called only in reset
and when a fin
is received. It'd be probably better to rename this proc to a verb.
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.
channel.join()
is completed after LPstream.closeImpl()
is called.
LPStream.closeImpl()
is called by actuallyClosed
here, and it's called after checking if closedRemotely
is completed.
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.
True, reverting.
8b5874c
to
3d6deed
Compare
3d6deed
to
3b038f9
Compare
@@ -11,6 +11,6 @@ COPY . nim-libp2p/ | |||
|
|||
RUN \ | |||
cd nim-libp2p && \ | |||
nim c --skipProjCfg --skipParentCfg --NimblePath:./nimbledeps/pkgs -p:nim-libp2p -d:chronicles_log_level=WARN --threads:off ./tests/transport-interop/main.nim | |||
nim c --skipProjCfg --skipParentCfg --NimblePath:./nimbledeps/pkgs -p:nim-libp2p -d:chronicles_log_level=WARN -d:chronicles_default_output_device=stderr --threads:off ./tests/transport-interop/main.nim |
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 how it should be according to the test spec in test-plans
. This is a bit unrelated to the current scope of the PR, but the PR itself was born from debugging this test and this change was necessary, otherwise, the test fails when increasing the log level. Ideally, it should be done in a different PR, but it is fine in this case.
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.
LGTM
returnedEoF
field