Skip to content

client/server timeout examples, doc pass hinting towards timeouts.#187

Open
cpu wants to merge 11 commits into
rustls:mainfrom
cpu:ci/timeout-examples
Open

client/server timeout examples, doc pass hinting towards timeouts.#187
cpu wants to merge 11 commits into
rustls:mainfrom
cpu:ci/timeout-examples

Conversation

@cpu

@cpu cpu commented Jul 16, 2026

Copy link
Copy Markdown
Member

Here's an attempt at exploring an alternative to #182 that adds client and server examples demonstrating thorough use of timeouts applied external to the core crate. This is mostly straight forward (though some extra care is needed w/ the lazy acceptor and understanding the dual await points).

In addition to the new examples I sprinkled the main API surfaces with rustdoc comments that hinted at the need for considering timeouts and offered some advice.

I was skeptical initially, but I think this might be a better route forwards compared to #182. If folks agree I'll pair it with an example in hyper-rustls, and then close 182 and associated bits.

cpu added 11 commits July 16, 2026 15:21
* Avoid the `rustls::` prefix for `RootCertStore` and `ClientConfig`
* Consistently use the `tokio_rustls::rustls` re-export.
Demonstrates using tokio-rustls and externally applying timeouts to TCP
connect, TLS handshake, reads/writes on a TLS stream, and graceful
shutdown.
* Avoid the `rustls::` prefix for `ServerConfig`.
* Consistently use the `tokio_rustls::rustls` re-export.
Demonstrates using tokio-rustls to accept & handle a client request
(both directly, and lazily), while applying timeouts.
@cpu cpu self-assigned this Jul 16, 2026

@ctz ctz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would perhaps consider folding the timeout-having examples into the others? As this kind of stuff tends to end up being the starting point for some developments, and it's easy to remove timeouts that are counterproductive than know that they are good practice in the first place?

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.

2 participants