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:
		| @@ -66,18 +66,11 @@ impl<'a, 'b: 'a> Request<'a, 'b> { | ||||
|     } | ||||
|  | ||||
|     /// Set the read timeout of the underlying NetworkStream. | ||||
|     #[cfg(feature = "timeouts")] | ||||
|     #[inline] | ||||
|     pub fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { | ||||
|         self.body.get_ref().get_ref().set_read_timeout(timeout) | ||||
|     } | ||||
|  | ||||
|     /// Set the read timeout of the underlying NetworkStream. | ||||
|     #[cfg(not(feature = "timeouts"))] | ||||
|     #[inline] | ||||
|     pub fn set_read_timeout(&self, _timeout: Option<Duration>) -> io::Result<()> { | ||||
|         Ok(()) | ||||
|     } | ||||
|     /// Get a reference to the underlying `NetworkStream`. | ||||
|     #[inline] | ||||
|     pub fn downcast_ref<T: NetworkStream>(&self) -> Option<&T> { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user