Skip to content

Commit

Permalink
client/network: Remove option to disable yamux flow control (parityte…
Browse files Browse the repository at this point in the history
…ch#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.
  • Loading branch information
mxinden authored Oct 19, 2020
1 parent 5620563 commit b49b666
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 23 deletions.
6 changes: 0 additions & 6 deletions client/cli/src/params/network_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ pub struct NetworkParams {
#[structopt(flatten)]
pub node_key_params: NodeKeyParams,

/// Disable the yamux flow control. This option will be removed in the future once there is
/// enough confidence that this feature is properly working.
#[structopt(long)]
pub no_yamux_flow_control: bool,

/// Enable peer discovery on local networks.
///
/// By default this option is true for `--dev` and false otherwise.
Expand Down Expand Up @@ -158,7 +153,6 @@ impl NetworkParams {
enable_mdns: !is_dev && !self.no_mdns,
allow_private_ipv4: !self.no_private_ipv4,
wasm_external_transport: None,
use_yamux_flow_control: !self.no_yamux_flow_control,
},
max_parallel_downloads: self.max_parallel_downloads,
allow_non_globals_in_dht: self.discover_local || is_dev,
Expand Down
3 changes: 0 additions & 3 deletions client/network/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ impl NetworkConfiguration {
enable_mdns: false,
allow_private_ipv4: true,
wasm_external_transport: None,
use_yamux_flow_control: false,
},
max_parallel_downloads: 5,
allow_non_globals_in_dht: false,
Expand Down Expand Up @@ -519,8 +518,6 @@ 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.
Expand Down
10 changes: 5 additions & 5 deletions client/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,12 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
behaviour.register_notifications_protocol(*engine_id, protocol_name.clone());
}
let (transport, bandwidth) = {
let (config_mem, config_wasm, flowctrl) = match params.network_config.transport {
TransportConfig::MemoryOnly => (true, None, false),
TransportConfig::Normal { wasm_external_transport, use_yamux_flow_control, .. } =>
(false, wasm_external_transport, use_yamux_flow_control)
let (config_mem, config_wasm) = match params.network_config.transport {
TransportConfig::MemoryOnly => (true, None),
TransportConfig::Normal { wasm_external_transport, .. } =>
(false, wasm_external_transport)
};
transport::build_transport(local_identity, config_mem, config_wasm, flowctrl)
transport::build_transport(local_identity, config_mem, config_wasm)
};
let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id.clone())
.peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER)
Expand Down
10 changes: 3 additions & 7 deletions client/network/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn build_transport(
keypair: identity::Keypair,
memory_only: bool,
wasm_external_transport: Option<wasm_ext::ExtTransport>,
use_yamux_flow_control: bool
) -> (Boxed<(PeerId, StreamMuxerBox), io::Error>, Arc<BandwidthSinks>) {
// Build the base layer of the transport.
let transport = if let Some(t) = wasm_external_transport {
Expand Down Expand Up @@ -109,12 +108,9 @@ pub fn build_transport(
mplex_config.max_buffer_len(usize::MAX);

let mut yamux_config = libp2p::yamux::Config::default();

if use_yamux_flow_control {
// Enable proper flow-control: window updates are only sent when
// buffered data has been consumed.
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);
}
// Enable proper flow-control: window updates are only sent when
// buffered data has been consumed.
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);

core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
.map_inbound(move |muxer| core::muxing::StreamMuxerBox::new(muxer))
Expand Down
1 change: 0 additions & 1 deletion client/service/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ fn node_config<G: RuntimeGenesis + 'static, E: ChainSpecExtension + Clone + 'sta
enable_mdns: false,
allow_private_ipv4: true,
wasm_external_transport: None,
use_yamux_flow_control: true,
};

Configuration {
Expand Down
1 change: 0 additions & 1 deletion utils/browser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ where
wasm_external_transport: Some(transport.clone()),
allow_private_ipv4: true,
enable_mdns: false,
use_yamux_flow_control: true,
};

let config = Configuration {
Expand Down

0 comments on commit b49b666

Please sign in to comment.