Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@

/// Send `WebTransport` datagram.
///
/// Consider calling [`Http3Client::datagram_send_queue_capacity`] before.
///
/// # Errors
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
Expand All @@ -838,6 +840,8 @@

/// Send `ConnectUdp` datagram.
///
/// Consider calling [`Http3Client::datagram_send_queue_capacity`] before.
///
/// # Errors
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
Expand All @@ -854,6 +858,13 @@
.connect_udp_send_datagram(session_id, &mut self.conn, buf, id)
}

/// Returns the number of QUIC datagrams that can still be queued for
/// sending before the queue is full.
#[must_use]
pub fn datagram_send_queue_capacity(&self) -> usize {
self.conn.datagram_send_queue_capacity()

Check warning on line 865 in neqo-http3/src/connection_client.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace Http3Client::datagram_send_queue_capacity -> usize with 1

Check warning on line 865 in neqo-http3/src/connection_client.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace Http3Client::datagram_send_queue_capacity -> usize with 0
}

/// Returns the current max size of a datagram that can fit into a packet.
/// The value will change over time depending on the encoded size of the
/// packet number, ack frames, etc.
Expand Down
7 changes: 7 additions & 0 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3868,6 +3868,13 @@
.add_datagram(buf, id.into(), &mut self.stats.borrow_mut())
}

/// Returns the number of QUIC datagrams that can still be queued for
/// sending before the queue is full.
#[must_use]
pub fn datagram_send_queue_capacity(&self) -> usize {
self.quic_datagrams.send_queue_capacity()

Check warning on line 3875 in neqo-transport/src/connection/mod.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace Connection::datagram_send_queue_capacity -> usize with 1

Check warning on line 3875 in neqo-transport/src/connection/mod.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace Connection::datagram_send_queue_capacity -> usize with 0
}

/// Return the PLMTU of the primary path.
///
/// # Panics
Expand Down
6 changes: 6 additions & 0 deletions neqo-transport/src/quic_datagrams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
Ok(())
}

/// Returns the number of QUIC datagrams that can still be queued for
/// sending before the queue is full.
pub fn send_queue_capacity(&self) -> usize {
self.max_queued_outgoing_datagrams - self.datagrams.len()

Check warning on line 192 in neqo-transport/src/quic_datagrams.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace - with / in QuicDatagrams::send_queue_capacity

Check warning on line 192 in neqo-transport/src/quic_datagrams.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace - with + in QuicDatagrams::send_queue_capacity

Check warning on line 192 in neqo-transport/src/quic_datagrams.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace QuicDatagrams::send_queue_capacity -> usize with 1

Check warning on line 192 in neqo-transport/src/quic_datagrams.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace QuicDatagrams::send_queue_capacity -> usize with 0
}

pub fn handle_datagram(&self, data: &[u8], stats: &mut Stats) -> Res<()> {
if self.local_datagram_size < u64::try_from(data.len())? {
return Err(Error::ProtocolViolation);
Expand Down
Loading