hyper
hyper copied to clipboard
[Waiting for modification] add conn idle timeout
#2355 I'd like to ask if it's appropriate to carry out an idle check in these
This is only a demo to check whether there is a big problem in selecting the time point for connection timeout. I'll re-implement one later on, based on the community's recommendations.
@paolobarbolini Do you have any good suggestions for me?
Spelling? Missing u
idle_timeot: Arc<Mutex<Pin<Box<Sleep>>>>
Also is changing Cargo.toml required?
log = "0.4.14"
And why not use:
if let Err(_) = timeout(Duration::from_secs(10), fut).await {
println!("did not receive value within 10 seconds");
}
https://docs.rs/tokio/latest/tokio/time/fn.timeout.html (im not very familiar with server part of hyper)
Spelling? Missing
uidle_timeot: Arc<Mutex<Pin<Box<Sleep>>>>Also is changing
Cargo.tomlrequired?log = "0.4.14"And why not use:
if let Err(_) = timeout(Duration::from_secs(10), fut).await { println!("did not receive value within 10 seconds"); }https://docs.rs/tokio/latest/tokio/time/fn.timeout.html (im not very familiar with server part of hyper)
@deputinizer Thank you very much, and I'll take the time to submit a formal pull request later, with the corresponding tests and comments. This submission is my feasibility verification of this function, so I write it casually. My main concern is that there may be problems with this core implementation, especially for h2, resulting in a major rewrite of the submitted code.
@deputinizer Can you tell me which line of code it is?
if let Err(_) = timeout(Duration::from_secs(10), fut).await {
println!("did not receive value within 10 seconds");
}