Skip to content

feat: add TCP linger configuration - #3138

Closed
cfilipescu wants to merge 2 commits into
seanmonstar:masterfrom
cfilipescu:feat/tcp-linger
Closed

cfilipescu wants to merge 2 commits into
seanmonstar:masterfrom
cfilipescu:feat/tcp-linger

Conversation

@cfilipescu

@cfilipescu cfilipescu commented Nov 11, 2026 •

Copy link
Copy Markdown

Expose ClientBuilder::tcp_linger on the async and blocking clients so applications can configure SO_LINGER on outbound TCP sockets. For example, tcp_linger(Duration::ZERO) opts into abortive close for workloads that otherwise accumulate local TIME_WAIT state. The default is None, preserving existing behavior.

Wrap the existing hyper-util HTTP connector internally and apply the option to the connected TCP stream before TLS or HTTP/SOCKS proxy handshakes. This uses Hyper's supported connector interface and needs no Hyper changes. The wrapper future adds no allocation. Unix sockets, Windows named pipes, and HTTP/3 are unaffected. API documentation describes the data-loss implications of zero linger and potential blocking with nonzero durations.

This PR includes no test changes.

Validation:

  • Existing client, connector-layer, proxy, and Unix-socket integration suites passed with blocking,socks enabled: 48 tests passed and two existing tests were ignored.
  • cargo check --features blocking,socks and cargo check --no-default-features passed.
  • Earlier feature checks also passed with native TLS, both TLS backends, and rustls-no-provider; the implementation is unchanged since those checks.
  • cargo fmt, explicit rustfmt checks for the changed source files, and git diff --check passed.

An additional strict Clippy run reports pre-existing lints in the base branch, including non_minimal_cfg, multiple_bound_locations, and io_other_error. These unrelated lints are outside this change.

@cfilipescu

Copy link
Copy Markdown
Author

@codex review

@cfilipescu cfilipescu closed this Nov 11, 2026
@cfilipescu
cfilipescu deleted the feat/tcp-linger branch November 11, 2026 21:34
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