Skip to content

Commit

Permalink
Add --initial-max-udp-payload-size command line option for perf
Browse files Browse the repository at this point in the history
client and server binaries to change the initial size of UDP
packet payload.
  • Loading branch information
stormshield-damiend authored and djc committed Oct 28, 2022
1 parent cebfb27 commit b80baa0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion perf/src/bin/perf_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ struct Opt {
/// Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`.
#[clap(long = "keylog")]
keylog: bool,
/// UDP payload size that the network must be capable of carrying
#[clap(long, default_value = "1200")]
initial_max_udp_payload_size: u16,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -122,7 +125,11 @@ async fn run(opt: Opt) -> Result<()> {
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
}

let cfg = quinn::ClientConfig::new(Arc::new(crypto));
let mut transport = quinn::TransportConfig::default();
transport.initial_max_udp_payload_size(opt.initial_max_udp_payload_size);

let mut cfg = quinn::ClientConfig::new(Arc::new(crypto));
cfg.transport_config(Arc::new(transport));

let stream_stats = OpenStreamStats::default();

Expand Down
9 changes: 8 additions & 1 deletion perf/src/bin/perf_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct Opt {
/// Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`.
#[clap(long = "keylog")]
keylog: bool,
/// UDP payload size that the network must be capable of carrying
#[clap(long, default_value = "1200")]
initial_max_udp_payload_size: u16,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -81,7 +84,11 @@ async fn run(opt: Opt) -> Result<()> {
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
}

let server_config = quinn::ServerConfig::with_crypto(Arc::new(crypto));
let mut transport = quinn::TransportConfig::default();
transport.initial_max_udp_payload_size(opt.initial_max_udp_payload_size);

let mut server_config = quinn::ServerConfig::with_crypto(Arc::new(crypto));
server_config.transport_config(Arc::new(transport));

let socket = bind_socket(opt.listen, opt.send_buffer_size, opt.recv_buffer_size)?;

Expand Down

0 comments on commit b80baa0

Please sign in to comment.