Skip to main content

libhttp3/
lib.rs

1use std::time::Duration;
2
3pub mod client;
4pub mod server;
5
6pub use client::{H3Client, H3Response, SseEvent, SseStream};
7
8/// Idle timeout advertised by both ends. QUIC uses the lower of the two.
9pub const MAX_IDLE_TIMEOUT: Duration = Duration::from_secs(60);
10
11/// PING interval for an otherwise-idle connection. Stays well under
12/// [`MAX_IDLE_TIMEOUT`] so a lost PING is not fatal.
13pub const KEEP_ALIVE_INTERVAL: Duration = Duration::from_secs(15);
14
15#[cfg(test)]
16mod tests {
17    use super::{KEEP_ALIVE_INTERVAL, MAX_IDLE_TIMEOUT};
18
19    #[test]
20    fn several_pings_can_be_lost_before_the_connection_idles_out() {
21        assert!(KEEP_ALIVE_INTERVAL * 3 < MAX_IDLE_TIMEOUT);
22    }
23}