Added note about short timeouts to set_timeout docs

This commit is contained in:
Emi Tatsuo 2020-11-18 23:29:00 -05:00
parent bbf034cf47
commit a778774189
Signed by: Emi
GPG key ID: 68FAB2E2E6DFC98B

View file

@ -139,7 +139,12 @@ impl<A: ToSocketAddrs> Builder<A> {
/// If you would like a timeout for your code itself, please use /// If you would like a timeout for your code itself, please use
/// [`tokio::time::Timeout`] to implement it internally. /// [`tokio::time::Timeout`] to implement it internally.
/// ///
/// The default timeout is 30 seconds. /// **The default timeout is 30 seconds.** If you are considering changing this, keep
/// in mind that some clients, when recieving a file type not supported for display,
/// will prompt the user how they would like to proceed. While this occurs, the
/// request hangs open. Setting a short timeout may close the prompt before user has
/// a chance to respond. If you are only serving `text/plain` and `text/gemini`, this
/// should not be a problem.
pub fn set_timeout(mut self, timeout: Duration) -> Self { pub fn set_timeout(mut self, timeout: Duration) -> Self {
self.timeout = timeout; self.timeout = timeout;
self self