Skip to content
Open
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
27 changes: 13 additions & 14 deletions neqo-bin/src/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@
let socket = std::net::UdpSocket::bind(addr)?;
let state = quinn_udp::UdpSocketState::new((&socket).into())?;

// FIXME: We need to experiment if increasing this actually improves performance.
// Also, on BSD and Apple targets, this seems to increase the `net.inet.udp.maxdgram`
// sysctl, which is not the same as the socket buffer.
// if send_buf_before < ONE_MB {
// state.set_send_buffer_size((&socket).into(), ONE_MB)?;
// let send_buf_after = state.send_buffer_size((&socket).into())?;
// qdebug!("Increasing socket send buffer size from {send_buf_before} to {ONE_MB}, now:
// {send_buf_after}"); } else {
// qdebug!("Default socket send buffer size is {send_buf_before}, not changing");
// }
qdebug!(
"Default socket send buffer size is {:?}",
state.send_buffer_size((&socket).into())
);
let send_buf_before = state.send_buffer_size((&socket).into())?;
if send_buf_before < ONE_MB {

Check warning on line 34 in neqo-bin/src/udp.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace < with <= in Socket::bind

Check warning on line 34 in neqo-bin/src/udp.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace < with > in Socket::bind

Check warning on line 34 in neqo-bin/src/udp.rs

View workflow job for this annotation

GitHub Actions / Find mutants

Missed mutant

replace < with == in Socket::bind
// Same as Firefox.
// The initial default equals `net.inet.udp.maxdgram` (9216 on macOS) but setting
// `SO_SNDBUF` does not modify that sysctl; it only changes the per-socket buffer.
state.set_send_buffer_size((&socket).into(), ONE_MB)?;
qdebug!(
"Increasing socket send buffer size from {send_buf_before} to {ONE_MB}, now: {:?}",
state.send_buffer_size((&socket).into())
);
Comment on lines +39 to +42

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

state.send_buffer_size((&socket).into()) returns a Result, but here it's logged with {:?} without ?, so the message will print Ok(..)/Err(..) and any error is silently ignored. Consider capturing send_buf_after using ? (or handling/logging the error explicitly) and logging the actual size to keep the log message accurate and error handling consistent with the earlier send_buf_before query.

Copilot uses AI. Check for mistakes.
} else {
qdebug!("Default socket send buffer size is {send_buf_before}, not changing");
}

let recv_buf_before = state.recv_buffer_size((&socket).into())?;
if recv_buf_before < ONE_MB {
Expand Down
Loading