hyper icon indicating copy to clipboard operation
hyper copied to clipboard

[Waiting for modification] add conn idle timeout

Open silence-coding opened this issue 3 years ago • 5 comments

#2355 I'd like to ask if it's appropriate to carry out an idle check in these

silence-coding avatar May 06 '22 08:05 silence-coding

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.

silence-coding avatar May 07 '22 02:05 silence-coding

@paolobarbolini Do you have any good suggestions for me?

silence-coding avatar May 07 '22 02:05 silence-coding

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)

deputinizer avatar May 07 '22 11:05 deputinizer

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)

@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.

silence-coding avatar May 09 '22 02:05 silence-coding

@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");
}

silence-coding avatar May 09 '22 02:05 silence-coding