From b80baa008d2eb0a585472772be449432a3c48fd8 Mon Sep 17 00:00:00 2001 From: Damien Deville Date: Thu, 27 Oct 2022 11:22:24 +0200 Subject: [PATCH] Add --initial-max-udp-payload-size command line option for perf client and server binaries to change the initial size of UDP packet payload. --- perf/src/bin/perf_client.rs | 9 ++++++++- perf/src/bin/perf_server.rs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/perf/src/bin/perf_client.rs b/perf/src/bin/perf_client.rs index 84d3ed9d0..ad49b28dd 100644 --- a/perf/src/bin/perf_client.rs +++ b/perf/src/bin/perf_client.rs @@ -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")] @@ -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(); diff --git a/perf/src/bin/perf_server.rs b/perf/src/bin/perf_server.rs index f5b40a57e..48e37a435 100644 --- a/perf/src/bin/perf_server.rs +++ b/perf/src/bin/perf_server.rs @@ -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")] @@ -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)?;