Skip to content

fix: eliminate tls acceptor unwrap in server accept loops - #65

Merged
kacy merged 1 commit into
mainfrom
fix/tls-acceptor-unwrap
Feb 8, 2026
Merged

fix: eliminate tls acceptor unwrap in server accept loops#65
kacy merged 1 commit into
mainfrom
fix/tls-acceptor-unwrap

Conversation

@kacy

@kacy kacy commented Feb 8, 2026

Copy link
Copy Markdown
Owner

summary

both accept loops in server.rs (sharded and concurrent modes) had a tls_listener.as_ref().map(|(_, a)| a.clone()).unwrap() call to grab the TlsAcceptor inside the TLS select branch. while logically safe (the branch only fires when TLS is configured), the unwrap is fragile — future refactoring could break the invariant and cause a panic in production.

this changes each tls_accept closure to return the TlsAcceptor alongside the stream and address, so the select branch receives it directly via destructuring. the unwrap lines are removed entirely.

what was tested

  • cargo build -p ember-server — compiles cleanly
  • cargo test -p ember-server — all 32 tests pass
  • cargo clippy -p ember-server -- -D warnings — no warnings

modify both tls_accept closures (sharded and concurrent modes) to
return the TlsAcceptor alongside the stream, so the select branch
receives it directly without needing to unwrap the option. this
removes a fragile invariant that could panic if future refactoring
broke the assumption that the branch only fires when tls is configured.
@kacy
kacy merged commit 7dee2e3 into main Feb 8, 2026
5 checks passed
@kacy
kacy deleted the fix/tls-acceptor-unwrap branch February 8, 2026 20:57
kacy added a commit that referenced this pull request Feb 11, 2026
modify both tls_accept closures (sharded and concurrent modes) to
return the TlsAcceptor alongside the stream, so the select branch
receives it directly without needing to unwrap the option. this
removes a fragile invariant that could panic if future refactoring
broke the assumption that the branch only fires when tls is configured.
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