-
Notifications
You must be signed in to change notification settings - Fork 959
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
dropping NegotiatedSubstream should close it #2459
Comments
Are you closing (/dropping) the stream only, or the connection as well? As an aside, why are you using |
I used mplex by virtue of copying one of the test cases from libp2p. My protocol’s output value is the NegotiatedSubstream which the ProtocolsHandler then uses to send and receive data. It is this value I’m dropping — not sure whether you call that stream or connection. |
Is this still an issue? The I am considering working on #508 next which should give us clarity over this behaviour. |
I don't think we can ever do this. From looking at existing implementations, it seems that dropping a stream will send a reset frame. This allows a remote to distinguish between a gracefully closed stream and an abruptly closed one. If we don't want this behaviour, then I don't see any other application of the RESET frames given the interface that |
@thomaseizinger I believe the original comment said that the reset frame isn't sent at all:
|
I think this will only happen if the That being said, mplex doesn't use that at the moment because it was designed to make progress internally as soon as any other poll function is called. I believe the reset frame would be sent on the next call to any of the poll functions. |
@mxinden Is it worth adopting the mplex implementation to use |
Given that we have yamux, which in my eyes is better than mplex in every regard (libp2p/specs#402), I don't think it makes sense to invest in mplex.
When |
Unfortunately not. I explored that path and it will lead to endless loop because Not sure if it is worth the effort. |
We reset streams on drop to signal unexpected EOF. |
I’m currently implementing a streaming response protocol for high message volume (where OneShot incurs undue overhead) and found this behaviour while testing:
If I add
io.close().await?
in my handler after sending those two bytes, then the receiver sees the stream close and everything works. Reading the comment for Multiplexed::drop_stream it seems that there should be a reset frame, but that is not triggered — perhaps that “next opportunity” only occurs if there is other activity polling the swarm?The text was updated successfully, but these errors were encountered: