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

make it more likely that a STREAM frame is bundled with the FIN #2504

Merged
merged 1 commit into from
May 1, 2020

Conversation

marten-seemann
Copy link
Member

@marten-seemann marten-seemann commented Apr 18, 2020

Fixes #2435.

Currently, on Stream.Write(), we save the slice in dataForWriting, and pop STREAM frames from that slice. Write only returns after all the data has been popped in STREAM frames.

This PR changes this logic: As soon as dataForWriting becomes smaller than a certain size x, it's copied to a STREAM frame, which can the be popped the next time we assemble a packet. This allows us to return Write() when all data but x bytes have been sent out. When the user now calls Close(), this is much more likely to happen before we popped that last STREAM frame, allowing us to set the FIN bit on that frame (and avoiding sending out an empty STREAM frame with FIN set in a separate packet).

@codecov-io
Copy link

codecov-io commented Apr 18, 2020

Codecov Report

Merging #2504 into master will decrease coverage by 0.02%.
The diff coverage is 97.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2504      +/-   ##
==========================================
- Coverage   86.10%   86.08%   -0.02%     
==========================================
  Files         122      122              
  Lines        9490     9539      +49     
==========================================
+ Hits         8171     8211      +40     
- Misses        982      988       +6     
- Partials      337      340       +3     
Impacted Files Coverage Δ
send_stream.go 92.96% <97.67%> (+0.01%) ⬆️
internal/handshake/header_protector.go 75.38% <0.00%> (-7.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81daa8a...9905774. Read the comment docs.

send_stream.go Show resolved Hide resolved
@marten-seemann marten-seemann merged commit 6d66eac into master May 1, 2020
@marten-seemann marten-seemann deleted the stream-buffer branch May 1, 2020 04:34
@Stebalien Stebalien mentioned this pull request May 26, 2020
77 tasks
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.

bundle STREAM frame and FIN
3 participants