Skip to content

Commit

Permalink
Merge branch 'main' into smallvec-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
martinthomson committed Dec 11, 2024
2 parents dae481d + a1b9364 commit f8e2c98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions neqo-http3/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -1336,7 +1337,6 @@ impl Http3Connection {
recv_events: Box<dyn RecvStreamEvents>,
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 {
Expand Down
13 changes: 12 additions & 1 deletion neqo-http3/tests/webtransport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit f8e2c98

Please sign in to comment.