Add command-line flag to enable yamux flow control. (#4892)

* Add command-line flag to enable yamux flow control.

We never enabled proper flow-control for yamux streams which may cause
stream buffers to exceed their configured limit when the stream
producer outpaces the stream consumer. By switching the window update
mode to on-read, producers will only receive more sending credit when
all data has been consumed from the stream buffer. Using this option
creates backpressure on producers. However depending on the protocol
there is a risk of deadlock, if both endpoints concurrently attempt to
send more data than they have credit for and neither side reads before
finishing their writes. To facilitate proper testing, this PR adds a
command-line flag `use-yamux-flow-control`.

* Replace comment with generic message.
This commit is contained in:
Toralf Wittner
2020-02-12 11:24:25 +01:00
committed by GitHub
parent ae70b10326
commit 818c05bbc2
9 changed files with 32 additions and 8 deletions
+3
View File
@@ -292,6 +292,7 @@ impl Default for NetworkConfiguration {
enable_mdns: false,
allow_private_ipv4: true,
wasm_external_transport: None,
use_yamux_flow_control: false,
},
max_parallel_downloads: 5,
}
@@ -348,6 +349,8 @@ pub enum TransportConfig {
/// This parameter exists whatever the target platform is, but it is expected to be set to
/// `Some` only when compiling for WASM.
wasm_external_transport: Option<wasm_ext::ExtTransport>,
/// Use flow control for yamux streams if set to true.
use_yamux_flow_control: bool,
},
/// Only allow connections within the same process.