From 6bb838f2050b0759806aaf95762438ee1ad0884a Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Wed, 24 Jun 2020 18:36:08 +0200 Subject: [PATCH] Fix building with socks-proxy feature (#91) This PR corrects a variable name and type, and ensures we test the socks-proxy feature as part of the test matrix. --- .github/workflows/test.yml | 1 + src/stream.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7324d90..62652b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ jobs: feature: - charset - cookies + - socks-proxy env: RUST_BACKTRACE: "1" steps: diff --git a/src/stream.rs b/src/stream.rs index 4cc0d71..c5cda5d 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -523,8 +523,9 @@ fn connect_socks5( let (lock, cvar) = &*master_signal; let done = lock.lock().unwrap(); + let timeout_connect = time_until_deadline(deadline)?; let done_result = cvar - .wait_timeout(done, time_until_deadline(deadline)?) + .wait_timeout(done, timeout_connect) .unwrap(); let done = done_result.0; if *done { @@ -534,7 +535,7 @@ fn connect_socks5( ErrorKind::TimedOut, format!( "SOCKS5 proxy: {}:{} timed out connecting after {}ms.", - host, port, timeout_connect + host, port, timeout_connect.as_millis() ), )); }