fix: eliminate tls acceptor unwrap in server accept loops - #65
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
both accept loops in
server.rs(sharded and concurrent modes) had atls_listener.as_ref().map(|(_, a)| a.clone()).unwrap()call to grab theTlsAcceptorinside 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_acceptclosure to return theTlsAcceptoralongside 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 cleanlycargo test -p ember-server— all 32 tests passcargo clippy -p ember-server -- -D warnings— no warnings