From 2f99d0de59e44b1fcd0bba4850fdd4d543a9c4f2 Mon Sep 17 00:00:00 2001 From: Stephen Date: Thu, 16 Jul 2020 20:06:26 -0300 Subject: [PATCH] Bugfix --- matrix_sdk/src/client.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index f811abd98..16e4325c3 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -105,7 +105,7 @@ pub struct ClientConfig { user_agent: Option, disable_ssl_verification: bool, base_config: BaseClientConfig, - timeout: Duration, + timeout: Option, } // #[cfg_attr(tarpaulin, skip)] @@ -202,7 +202,7 @@ impl ClientConfig { /// Set a timeout duration for all HTTP requests. The default is no timeout. pub fn timeout(mut self, timeout: Duration) -> Self { - self.timeout = timeout; + self.timeout = Some(timeout); self } } @@ -305,7 +305,12 @@ impl Client { Err(_e) => panic!("Error parsing homeserver url"), }; - let http_client = reqwest::Client::builder().timeout(config.timeout); + let http_client = reqwest::Client::builder(); + + let http_client = match (config.timeout) { + Some(x) => http_client.timeout(x), + None => http_client, + }; #[cfg(not(target_arch = "wasm32"))] let http_client = {