Skip to content

Reject DATAGRAMs larger than the send buffer#2626

Open
zerox80 wants to merge 3 commits into
quinn-rs:mainfrom
zerox80:upstream-datagram-send-buffer-limit
Open

Reject DATAGRAMs larger than the send buffer#2626
zerox80 wants to merge 3 commits into
quinn-rs:mainfrom
zerox80:upstream-datagram-send-buffer-limit

Conversation

@zerox80
Copy link
Copy Markdown

@zerox80 zerox80 commented Apr 27, 2026

Follow-up to #2625.

A DATAGRAM larger than datagram_send_buffer_size cannot fit in the outgoing send buffer by itself. This returns TooLarge before trying either send mode, so the behavior is the same for drop = true and drop = false.

Tested with:

cargo fmt --check
cargo test -p quinn-proto --lib
cargo test -p quinn-proto datagram

@zerox80 zerox80 force-pushed the upstream-datagram-send-buffer-limit branch from 134613b to 8976994 Compare April 27, 2026 22:03
Comment thread quinn-proto/src/connection/datagrams.rs Outdated
.expect("datagrams.outgoing_total desynchronized");
trace!(len = prev.data.len(), "dropping outgoing datagram");
self.conn.datagrams.outgoing_total -= prev.data.len();
if data.len() > self.conn.config.datagram_send_buffer_size {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the behavior correct when !drop?

@zerox80 zerox80 force-pushed the upstream-datagram-send-buffer-limit branch from 8976994 to c9ceb0c Compare April 28, 2026 06:04
@zerox80
Copy link
Copy Markdown
Author

zerox80 commented Apr 28, 2026

Updated this too. The size check now happens before the drop branch, so drop = false returns TooLarge for a datagram that cannot fit in the send buffer. I added a test for both send modes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants