Skip to content

Commit 89fdf74

Browse files
committed
Sets the timeout as optional
1 parent 3e26603 commit 89fdf74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ impl ConfigBuilder {
5353
}
5454

5555
/// Sets the timeout
56-
pub fn timeout(mut self, timeout: u8) -> Result<Self, Error> {
57-
if self.config.socks5.is_some() {
56+
pub fn timeout(mut self, timeout: Option<u8>) -> Result<Self, Error> {
57+
if timeout.is_some() && self.config.socks5.is_some() {
5858
return Err(Error::BothSocksAndTimeout);
5959
}
60-
self.config.timeout = Some(Duration::from_secs(timeout as u64));
60+
self.config.timeout = timeout.map(|t| Duration::from_secs(t as u64));
6161
Ok(self)
6262
}
6363

0 commit comments

Comments
 (0)