-
Notifications
You must be signed in to change notification settings - Fork 24
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: fix some msg left on buffer #288
Conversation
8b17626
to
520a358
Compare
520a358
to
0c5c1e4
Compare
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.
Add some test cases?
@@ -176,11 +175,11 @@ where | |||
} | |||
|
|||
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> { | |||
Pin::new(&mut self.socket).as_mut().poll_flush(cx) | |||
self.socket.poll_flush_unpin(cx) |
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's the difference?
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's the difference?
No difference, may look better
There have been tests, and occasionally failed, but did not pay attention to it, thought it was a problem caused by poor ci machine |
@@ -82,6 +82,9 @@ pub struct Session<T> { | |||
event_sender: Sender<StreamEvent>, | |||
// For receive events from sub streams | |||
event_receiver: Receiver<StreamEvent>, | |||
// The control information must be sent successfully and will not cause memory problems | |||
unbound_event_sender: UnboundedSender<StreamEvent>, |
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.
unbounded
is dangerous, giving a large enough bound channel is better.
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 channel is only used to send control information(window update and close), there is no possibility of unlimited increase
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.
There is an integration test in CKB fails randomly, and it may causes by this issue.
I ran it again and again for more than 4 hours with this patch, it didn't fail.
So, I approved this pull request.
start_send
just set data to buffer,flush
will try to write data to inner iocodec write buffer left:
https://github.com/nervosnetwork/tentacle/blob/fix-message-delay/tentacle/src/substream.rs#L427
yamux read buffer left:
https://github.com/nervosnetwork/tentacle/blob/fix-message-delay/yamux/src/stream.rs#L302