add config on transmit window size
This commit is contained in:
parent
9f86717f93
commit
cfe9379eb6
@ -87,6 +87,16 @@ tuic-client -c PATH/TO/CONFIG
|
|||||||
// Default: false
|
// Default: false
|
||||||
"disable_native_certs": 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
|
// Optional. Interval between UDP packet fragment garbage collection
|
||||||
// Default: 3s
|
// Default: 3s
|
||||||
"gc_interval": "3s",
|
"gc_interval": "3s",
|
||||||
|
@ -88,6 +88,12 @@ pub struct Relay {
|
|||||||
#[serde(default = "default::relay::disable_native_certs")]
|
#[serde(default = "default::relay::disable_native_certs")]
|
||||||
pub disable_native_certs: bool,
|
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(
|
#[serde(
|
||||||
default = "default::relay::gc_interval",
|
default = "default::relay::gc_interval",
|
||||||
deserialize_with = "deserialize_duration"
|
deserialize_with = "deserialize_duration"
|
||||||
@ -190,6 +196,14 @@ mod default {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn send_window() -> u64 {
|
||||||
|
2u64.pow(24) * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn receive_window() -> u32 {
|
||||||
|
2u32.pow(24)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn gc_interval() -> Duration {
|
pub fn gc_interval() -> Duration {
|
||||||
Duration::from_secs(3)
|
Duration::from_secs(3)
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,8 @@ impl Endpoint {
|
|||||||
tp_cfg
|
tp_cfg
|
||||||
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
|
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
|
||||||
.max_concurrent_uni_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);
|
.max_idle_timeout(None);
|
||||||
|
|
||||||
match cfg.congestion_control {
|
match cfg.congestion_control {
|
||||||
|
@ -79,6 +79,16 @@ tuic-server -c PATH/TO/CONFIG
|
|||||||
// Default: 1500
|
// Default: 1500
|
||||||
"max_external_packet_size": 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
|
// Optional. Interval between UDP packet fragment garbage collection
|
||||||
// Default: 3s
|
// Default: 3s
|
||||||
"gc_interval": "3s",
|
"gc_interval": "3s",
|
||||||
|
@ -70,6 +70,12 @@ pub struct Config {
|
|||||||
#[serde(default = "default::max_external_packet_size")]
|
#[serde(default = "default::max_external_packet_size")]
|
||||||
pub max_external_packet_size: usize,
|
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(
|
#[serde(
|
||||||
default = "default::gc_interval",
|
default = "default::gc_interval",
|
||||||
deserialize_with = "deserialize_duration"
|
deserialize_with = "deserialize_duration"
|
||||||
@ -154,6 +160,14 @@ mod default {
|
|||||||
1500
|
1500
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn send_window() -> u64 {
|
||||||
|
2u64.pow(24) * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn receive_window() -> u32 {
|
||||||
|
2u32.pow(24)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn gc_interval() -> Duration {
|
pub fn gc_interval() -> Duration {
|
||||||
Duration::from_secs(3)
|
Duration::from_secs(3)
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,8 @@ impl Server {
|
|||||||
tp_cfg
|
tp_cfg
|
||||||
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
|
.max_concurrent_bidi_streams(VarInt::from(DEFAULT_CONCURRENT_STREAMS as u32))
|
||||||
.max_concurrent_uni_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(
|
.max_idle_timeout(Some(
|
||||||
IdleTimeout::try_from(cfg.max_idle_time).map_err(|_| Error::InvalidMaxIdleTime)?,
|
IdleTimeout::try_from(cfg.max_idle_time).map_err(|_| Error::InvalidMaxIdleTime)?,
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user