diff --git a/neqo-http3/src/connection.rs b/neqo-http3/src/connection.rs index f3ec804475..a59b6908e7 100644 --- a/neqo-http3/src/connection.rs +++ b/neqo-http3/src/connection.rs @@ -282,7 +282,7 @@ handle parsing and sending of HTTP part of the control stream. When HTTP headers `WebTransportSessionListener` as the `RecvMessage` event listener. `WebTransportSendStream` and `WebTransportRecvStream` are associated with a `WebTransportSession` -and they will be canceled if the session is closed. To be avle to do this `WebTransportSession` +and they will be canceled if the session is closed. To be able to do this `WebTransportSession` holds a list of its active streams and clean up is done in `remove_extended_connect`. ### `WebTransportSendStream` and `WebTransportRecvStream` @@ -1177,6 +1177,7 @@ impl Http3Connection { } let send_stream = self.send_streams.get_mut(&stream_id); + conn.stream_keep_alive(stream_id, true)?; match (send_stream, recv_stream, accept_res) { (None, None, _) => Err(Error::InvalidStreamId), @@ -1336,7 +1337,6 @@ impl Http3Connection { recv_events: Box, local: bool, ) { - // TODO conn.stream_keep_alive(stream_id, true)?; webtransport_session.borrow_mut().add_stream(stream_id); if stream_id.stream_type() == StreamType::UniDi { if local { diff --git a/neqo-http3/tests/webtransport.rs b/neqo-http3/tests/webtransport.rs index 9417bb3a4f..1d29b702bc 100644 --- a/neqo-http3/tests/webtransport.rs +++ b/neqo-http3/tests/webtransport.rs @@ -13,7 +13,7 @@ use neqo_http3::{ Http3ServerEvent, Http3State, WebTransportEvent, WebTransportRequest, WebTransportServerEvent, WebTransportSessionAcceptAction, }; -use neqo_transport::{StreamId, StreamType}; +use neqo_transport::{ConnectionParameters, StreamId, StreamType}; use test_fixture::{ anti_replay, fixture_init, now, CountingConnectionIdGenerator, DEFAULT_ADDR, DEFAULT_ALPN_H3, DEFAULT_KEYS, DEFAULT_SERVER_NAME, @@ -225,6 +225,17 @@ fn receive_data_server( wt_stream.unwrap() } +#[test] +fn wt_keepalive() { + let (mut client, mut server) = connect(); + let _wt_session = create_wt_session(&mut client, &mut server); + let idle_timeout = ConnectionParameters::default().get_idle_timeout(); + // Expect client and server to send PING after half of the idle timeout in order to keep + // connection alive. + assert_eq!(client.process_output(now()).callback(), idle_timeout / 2); + assert_eq!(server.process_output(now()).callback(), idle_timeout / 2); +} + #[test] fn wt_client_stream_uni() { const BUF_CLIENT: &[u8] = &[0; 10];