Fix connect_timeout for wasi-http#8085
Conversation
elliottt
left a comment
There was a problem hiding this comment.
This looks great, thank you!
| assert!( | ||
| matches!( | ||
| res.unwrap_err().downcast_ref::<ErrorCode>(), | ||
| Some(ErrorCode::ConnectionTimeout) | ||
| ), | ||
| "expected connection timeout" | ||
| ); |
There was a problem hiding this comment.
Thanks for matching the timeout explicitly here!
I see two uses in the |
Thanks for the review!
There should be three (https://github.com/bytecodealliance/wasmtime/blob/eebce11eb1fdfc67ab8fc7a06cb68ba1231dd7a6/crates/wasi-http/src/types.rs). One is now newly added near the Why I mentioned it is because it sounded a bit weird to me that the |
|
Ah! Sorry for misunderstanding. I think this is fine to leave it this way, but I agree that it's a little odd. Reading through the handshake implementation, it's assuming that the connection has already been made, so if anything we might want to remove the timeout on the second two uses in the function. |
|
I added #8104 to record the fact that we should look into removing the uses of |
@elliottt in #7356 mentions that
connect_timeout,first_byte_timeout, andbetween_bytes_timeoutshould be tested.This PR adds a test for
connect_timeoutand ensures thatTcpStream::connectadheres to the timeout. Without this fix, settingconnect_timeouthas no effect on hosts whereTcpStream::connecttries to connect.Note that the variable
connect_timeoutis also used a bit later for the handshake:wasmtime/crates/wasi-http/src/types.rs
Lines 207 to 213 in 8dd2ae9
I'm not sure whether using this variable twice is correct.