Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit b49b666

Browse files
authored
client/network: Remove option to disable yamux flow control (#7358)
With the `OnRead` flow control option yamux "send[s] window updates only when data is read on the receiving end" and not as soon as "a Stream's receive window drops to 0". Yamux flow control has proven itself. This commit removes the feature flag. Yamux flow control is now always enabled.
1 parent 5620563 commit b49b666

File tree

6 files changed

+8
-23
lines changed

6 files changed

+8
-23
lines changed

client/cli/src/params/network_params.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ pub struct NetworkParams {
9292
#[structopt(flatten)]
9393
pub node_key_params: NodeKeyParams,
9494

95-
/// Disable the yamux flow control. This option will be removed in the future once there is
96-
/// enough confidence that this feature is properly working.
97-
#[structopt(long)]
98-
pub no_yamux_flow_control: bool,
99-
10095
/// Enable peer discovery on local networks.
10196
///
10297
/// By default this option is true for `--dev` and false otherwise.
@@ -158,7 +153,6 @@ impl NetworkParams {
158153
enable_mdns: !is_dev && !self.no_mdns,
159154
allow_private_ipv4: !self.no_private_ipv4,
160155
wasm_external_transport: None,
161-
use_yamux_flow_control: !self.no_yamux_flow_control,
162156
},
163157
max_parallel_downloads: self.max_parallel_downloads,
164158
allow_non_globals_in_dht: self.discover_local || is_dev,

client/network/src/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ impl NetworkConfiguration {
451451
enable_mdns: false,
452452
allow_private_ipv4: true,
453453
wasm_external_transport: None,
454-
use_yamux_flow_control: false,
455454
},
456455
max_parallel_downloads: 5,
457456
allow_non_globals_in_dht: false,
@@ -519,8 +518,6 @@ pub enum TransportConfig {
519518
/// This parameter exists whatever the target platform is, but it is expected to be set to
520519
/// `Some` only when compiling for WASM.
521520
wasm_external_transport: Option<wasm_ext::ExtTransport>,
522-
/// Use flow control for yamux streams if set to true.
523-
use_yamux_flow_control: bool,
524521
},
525522

526523
/// Only allow connections within the same process.

client/network/src/service.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
334334
behaviour.register_notifications_protocol(*engine_id, protocol_name.clone());
335335
}
336336
let (transport, bandwidth) = {
337-
let (config_mem, config_wasm, flowctrl) = match params.network_config.transport {
338-
TransportConfig::MemoryOnly => (true, None, false),
339-
TransportConfig::Normal { wasm_external_transport, use_yamux_flow_control, .. } =>
340-
(false, wasm_external_transport, use_yamux_flow_control)
337+
let (config_mem, config_wasm) = match params.network_config.transport {
338+
TransportConfig::MemoryOnly => (true, None),
339+
TransportConfig::Normal { wasm_external_transport, .. } =>
340+
(false, wasm_external_transport)
341341
};
342-
transport::build_transport(local_identity, config_mem, config_wasm, flowctrl)
342+
transport::build_transport(local_identity, config_mem, config_wasm)
343343
};
344344
let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id.clone())
345345
.peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER)

client/network/src/transport.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub fn build_transport(
4141
keypair: identity::Keypair,
4242
memory_only: bool,
4343
wasm_external_transport: Option<wasm_ext::ExtTransport>,
44-
use_yamux_flow_control: bool
4544
) -> (Boxed<(PeerId, StreamMuxerBox), io::Error>, Arc<BandwidthSinks>) {
4645
// Build the base layer of the transport.
4746
let transport = if let Some(t) = wasm_external_transport {
@@ -109,12 +108,9 @@ pub fn build_transport(
109108
mplex_config.max_buffer_len(usize::MAX);
110109

111110
let mut yamux_config = libp2p::yamux::Config::default();
112-
113-
if use_yamux_flow_control {
114-
// Enable proper flow-control: window updates are only sent when
115-
// buffered data has been consumed.
116-
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);
117-
}
111+
// Enable proper flow-control: window updates are only sent when
112+
// buffered data has been consumed.
113+
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);
118114

119115
core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
120116
.map_inbound(move |muxer| core::muxing::StreamMuxerBox::new(muxer))

client/service/test/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ fn node_config<G: RuntimeGenesis + 'static, E: ChainSpecExtension + Clone + 'sta
225225
enable_mdns: false,
226226
allow_private_ipv4: true,
227227
wasm_external_transport: None,
228-
use_yamux_flow_control: true,
229228
};
230229

231230
Configuration {

utils/browser/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ where
5757
wasm_external_transport: Some(transport.clone()),
5858
allow_private_ipv4: true,
5959
enable_mdns: false,
60-
use_yamux_flow_control: true,
6160
};
6261

6362
let config = Configuration {

0 commit comments

Comments
 (0)