diff --git a/src/stream.rs b/src/stream.rs index 50b293bc..4d258962 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -181,15 +181,25 @@ pub(crate) fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result 0 { stream .set_read_timeout(Some(Duration::from_millis(unit.timeout_read as u64))) .ok(); + } else { + stream + .set_read_timeout(None) + .ok(); } + if unit.timeout_write > 0 { stream .set_write_timeout(Some(Duration::from_millis(unit.timeout_write as u64))) .ok(); + } else { + stream + .set_write_timeout(None) + .ok(); } Ok(stream)