Skip to content

Commit

Permalink
Add back mplex
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Aug 15, 2023
1 parent 59c24bc commit f494477
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ prometheus-client = "0.21.0"
unused_port = { path = "../../common/unused_port" }
delay_map = "0.3.0"
void = "1"
libp2p-mplex = "0.40.0"

[dependencies.libp2p]
version = "0.52"
Expand Down
10 changes: 9 additions & 1 deletion beacon_node/lighthouse_network/src/service/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ pub fn build_transport(
transport.or_transport(libp2p::websocket::WsConfig::new(trans_clone))
};

// mplex config
let mut mplex_config = libp2p_mplex::MplexConfig::new();
mplex_config.set_max_buffer_size(256);
mplex_config.set_max_buffer_behaviour(libp2p_mplex::MaxBufferBehaviour::Block);

// yamux config
let mut yamux_config = yamux::Config::default();
yamux_config.set_window_update_mode(yamux::WindowUpdateMode::on_read());
let (transport, bandwidth) = transport
.upgrade(core::upgrade::Version::V1)
.authenticate(generate_noise_config(&local_private_key))
.multiplex(yamux_config)
.multiplex(core::upgrade::SelectUpgrade::new(
yamux_config,
mplex_config,
))
.timeout(Duration::from_secs(10))
.boxed()
.with_bandwidth_logging();
Expand Down

0 comments on commit f494477

Please sign in to comment.