Skip to content
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 the case when a stream is closed while still having buffered data for write #330

Merged
merged 8 commits into from
Oct 11, 2023

Conversation

Nashatyrev
Copy link
Collaborator

@Nashatyrev Nashatyrev commented Sep 16, 2023

When a Stream is locally closed for writing but there is some data buffered for writing still, the YamuxHandler shouldn't immediately close the Stream for writing (by issuing FIN frame) and discarding the write buffer.

It should rather mark the Stream as closed for writing and wait for the suitable window update(s) to send the remaining data and only then issue a FIN frame.

* Add ByteBufQueue tests
* Writing exec path is always through fill/drain buffer
* Adopt/fix existing tests
* Add new test checking correct handling of negative sendWindowSize
@Nashatyrev Nashatyrev force-pushed the fix/close-after-buffered-write branch from 2161428 to 077815a Compare October 10, 2023 12:01
@Nashatyrev Nashatyrev marked this pull request as ready for review October 10, 2023 12:39
@Nashatyrev Nashatyrev mentioned this pull request Oct 10, 2023
Copy link
Collaborator

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Nashatyrev Nashatyrev merged commit ee02cf9 into libp2p:develop Oct 11, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants