feat(all): add socket timeouts
Methods added to `Client` and `Server` to control read and write timeouts of the underlying socket. Keep-Alive is re-enabled by default on the server, with a default timeout of 5 seconds. BREAKING CHANGE: This adds 2 required methods to the `NetworkStream` trait, `set_read_timeout` and `set_write_timeout`. Any local implementations will need to add them.
This commit is contained in:
		| @@ -2,7 +2,6 @@ | ||||
| use std::marker::PhantomData; | ||||
| use std::io::{self, Write}; | ||||
|  | ||||
| #[cfg(feature = "timeouts")] | ||||
| use std::time::Duration; | ||||
|  | ||||
| use url::Url; | ||||
| @@ -44,14 +43,12 @@ impl<W> Request<W> { | ||||
|     pub fn method(&self) -> method::Method { self.method.clone() } | ||||
|  | ||||
|     /// Set the write timeout. | ||||
|     #[cfg(feature = "timeouts")] | ||||
|     #[inline] | ||||
|     pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> { | ||||
|         self.message.set_write_timeout(dur) | ||||
|     } | ||||
|  | ||||
|     /// Set the read timeout. | ||||
|     #[cfg(feature = "timeouts")] | ||||
|     #[inline] | ||||
|     pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> { | ||||
|         self.message.set_read_timeout(dur) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user