rikhuijzer added the bug label to Issue #8106.
rikhuijzer opened issue #8106:
The following diff should be applied to ensure that the
connect_timeout
variable is correctly passed into thehandle
function.This code was removed in https://github.com/bytecodealliance/wasmtime/pull/8085#discussion_r1521942861 due to a failure on Windows MinGW x86_64.
diff --git a/crates/test-programs/src/bin/http_outbound_request_timeout.rs b/crates/test-programs/src/bin/http_outbound_request_timeout.rs index 8bd7601..198288e 100644 --- a/crates/test-programs/src/bin/http_outbound_request_timeout.rs +++ b/crates/test-programs/src/bin/http_outbound_request_timeout.rs @@ -1,13 +1,12 @@ use anyhow::Context; use std::net::SocketAddr; -use std::time::Duration; +use std::time::{Duration, Instant}; use test_programs::wasi::http::types::{ErrorCode, Method, Scheme}; fn main() { // This address inside the TEST-NET-3 address block is expected to time out. let addr = SocketAddr::from(([203, 0, 113, 12], 80)).to_string(); let timeout = Duration::from_millis(200); + let start = Instant::now(); let connect_timeout: Option<u64> = Some(timeout.as_nanos() as u64); let res = test_programs::http::request( Method::Get, @@ -30,9 +29,4 @@ fn main() { ), "expected connection timeout" ); + + let actual = start.elapsed(); + let tolerance = Duration::from_millis(100); + let upper_bound = timeout + tolerance; + assert!(actual < upper_bound); }
Last updated: Nov 22 2024 at 16:03 UTC