Skip to content

feat: support stream half-close - #10

Merged
black-binary merged 3 commits into
mainfrom
codex/support-half-close
Sep 4, 2026
Merged

black-binary merged 3 commits into
mainfrom
codex/support-half-close

Conversation

@black-binary

@black-binary black-binary commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • split stream lifecycle state into independent read-closed and write-closed halves
  • make AsyncWrite shutdown send FIN without closing the read direction
  • keep writes and flushes valid after a peer FIN, while preserving buffered read EOF ordering
  • retain orderly Drop, idle-timeout, and session-close behavior without duplicate FIN frames
  • bump the crate version to 0.4.0 because the observable stream lifecycle semantics change
  • document half-close semantics and the unchanged wire format

Tests first

The first commit adds four regression tests before the implementation. Against main, all four fail and expose the missing behavior: local shutdown causes premature read EOF, peer FIN rejects replies, one FIN marks the stream fully closed, and Drop after FIN loses the directional lifecycle.

The final branch adds coverage for FIN-before-accept, simultaneous crossed FIN/data, repeated shutdown and Drop emitting one FIN, idle activity refresh, and invalid late PSH handling.

Validation

  • cargo build --lib --tests --examples
  • cargo test --lib: 60 passed, 1 ignored
  • cargo test --lib --release: 60 passed, 1 ignored
  • release randomized lifecycle soak: passed
  • all three release stress tests repeated 10 times: 30/30 passed
  • cargo fmt --all -- --check
  • cargo clippy --lib --tests --examples --all-features -- -D warnings
  • rustdoc with warnings denied and doc tests

Closes #8

@black-binary
black-binary merged commit 0019a7f into main Sep 4, 2026
1 of 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.

support half close

1 participant