1
0

add config on transmit window size

This commit is contained in:
EAimTY 2023-05-27 21:17:08 +09:00
parent 9f86717f93
commit cfe9379eb6
6 changed files with 53 additions and 1 deletions

View File

@ -87,6 +87,16 @@ tuic-client -c PATH/TO/CONFIG
// Default: false
"disable_native_certs": false,
// Optional. Maximum number of bytes to transmit to a peer without acknowledgment
// Should be set to at least the expected connection latency multiplied by the maximum desired throughput
// Default: 16MiB * 2
"send_window": 33554432,
// Optional. Maximum number of bytes the peer may transmit without acknowledgement on any one stream before becoming blocked
// Should be set to at least the expected connection latency multiplied by the maximum desired throughput
// Default: 16MiB
"receive_window": 16777216,
// Optional. Interval between UDP packet fragment garbage collection
// Default: 3s
"gc_interval": "3s",

View File

@ -88,6 +88,12 @@ pub struct Relay {
#[serde(default = "default::relay::disable_native_certs")]
pub disable_native_certs: bool,
#[serde(default = "default::relay::send_window")]
pub send_window: u64,
#[serde(default = "default::relay::receive_window")]
pub receive_window: u32,
#[serde(
default = "default::relay::gc_interval",
deserialize_with = "deserialize_duration"
@ -190,6 +196,14 @@ mod default {
false
}
pub fn send_window() -> u64 {
2u64.pow(24) * 2
}
pub fn receive_window() -> u32 {
2u32.pow(24)
}
pub fn gc_interval() -> Duration {
Duration::from_secs(3)
}

View File

@ -72,6 +72,8 @@ impl Endpoint {
tp_cfg
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
.max_concurrent_uni_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
.send_window(cfg.send_window)
.stream_receive_window(VarInt::from_u32(cfg.receive_window))
.max_idle_timeout(None);
match cfg.congestion_control {

View File

@ -79,6 +79,16 @@ tuic-server -c PATH/TO/CONFIG
// Default: 1500
"max_external_packet_size": 1500,
// Optional. Maximum number of bytes to transmit to a peer without acknowledgment
// Should be set to at least the expected connection latency multiplied by the maximum desired throughput
// Default: 16MiB * 2
"send_window": 33554432,
// Optional. Maximum number of bytes the peer may transmit without acknowledgement on any one stream before becoming blocked
// Should be set to at least the expected connection latency multiplied by the maximum desired throughput
// Default: 16MiB
"receive_window": 16777216,
// Optional. Interval between UDP packet fragment garbage collection
// Default: 3s
"gc_interval": "3s",

View File

@ -70,6 +70,12 @@ pub struct Config {
#[serde(default = "default::max_external_packet_size")]
pub max_external_packet_size: usize,
#[serde(default = "default::send_window")]
pub send_window: u64,
#[serde(default = "default::receive_window")]
pub receive_window: u32,
#[serde(
default = "default::gc_interval",
deserialize_with = "deserialize_duration"
@ -154,6 +160,14 @@ mod default {
1500
}
pub fn send_window() -> u64 {
2u64.pow(24) * 2
}
pub fn receive_window() -> u32 {
2u32.pow(24)
}
pub fn gc_interval() -> Duration {
Duration::from_secs(3)
}

View File

@ -78,6 +78,8 @@ impl Server {
tp_cfg
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
.max_concurrent_uni_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
.send_window(cfg.send_window)
.stream_receive_window(VarInt::from_u32(cfg.receive_window))
.max_idle_timeout(Some(
IdleTimeout::try_from(cfg.max_idle_time).map_err(|_| Error::InvalidMaxIdleTime)?,
));