client/server timeout examples, doc pass hinting towards timeouts.#187
Open
cpu wants to merge 11 commits into
Open
client/server timeout examples, doc pass hinting towards timeouts.#187cpu wants to merge 11 commits into
cpu wants to merge 11 commits into
Conversation
* 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.
ctz
approved these changes
Jul 16, 2026
ctz
left a comment
Member
There was a problem hiding this comment.
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?
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.
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.