Skip to content

fix: normalize empty drained buffer to None in KtlsStream::new - #82

Closed
ArniDagur wants to merge 1 commit into
rustls:mainfrom
ArniDagur:fix-empty-drained-buffer
Closed

ArniDagur wants to merge 1 commit into
rustls:mainfrom
ArniDagur:fix-empty-drained-buffer

Conversation

@ArniDagur

Copy link
Copy Markdown
Contributor

Passing Some(Vec::new()) to KtlsStream::new leaves self.drained as Some((0, vec![])), so the first poll_read writes 0 bytes and returns Poll::Ready(Ok(())) (which callers interpret as EOF) instead of polling the inner stream.

Filters out empty Vecs in KtlsStream::new and adds a unit test.

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.20%. Comparing base (d9d1381) to head (59db563).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
ktls/src/ktls_stream.rs 77.77% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   87.69%   88.20%   +0.50%     
==========================================
  Files           6        6              
  Lines         943     1060     +117     
==========================================
+ Hits          827      935     +108     
- Misses        116      125       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Passing `Some(Vec::new())` to `KtlsStream::new` left `self.drained` as
`Some((0, vec![]))`, causing the first `poll_read` to write 0 bytes and
return `Poll::Ready(Ok(()))` (a spurious EOF) instead of polling the
inner stream.
@ArniDagur
ArniDagur force-pushed the fix-empty-drained-buffer branch from 59db563 to 5e9fd88 Compare December 3, 2026 16:41
@ArniDagur

Copy link
Copy Markdown
Contributor Author

Superseded by #84.

@ArniDagur ArniDagur closed this Dec 3, 2026
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.

1 participant