Skip to content

Commit

Permalink
fix(node): refactoring code
Browse files Browse the repository at this point in the history
Refactored code related to the "add feature flag for tcp/quic" commit for this PR.
  • Loading branch information
aed900 authored and RolandSherwin committed Aug 29, 2023
1 parent d983c7f commit 300dc94
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions sn_networking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,12 @@ impl SwarmDriver {
// Listen on the provided address
#[cfg(not(feature = "quic"))]
let addr = Multiaddr::from(addr.ip()).with(Protocol::Tcp(addr.port()));
#[cfg(not(feature = "quic"))]
let _listener_id = swarm_driver
.swarm
.listen_on(addr)
.expect("Failed to listen on the provided address");

#[cfg(feature = "quic")]
let addr = Multiaddr::from(addr.ip())
.with(Protocol::Udp(addr.port()))
.with(Protocol::QuicV1);
#[cfg(feature = "quic")]

let _listener_id = swarm_driver
.swarm
.listen_on(addr)
Expand Down Expand Up @@ -374,9 +369,7 @@ impl SwarmDriver {
.boxed();

#[cfg(feature = "quic")]
let quic_transport = libp2p_quic::tokio::Transport::new(quic::Config::new(&keypair));
#[cfg(feature = "quic")]
let mut transport = quic_transport
let mut transport = libp2p_quic::tokio::Transport::new(quic::Config::new(&keypair))
.map(|(peer_id, muxer), _| (peer_id, StreamMuxerBox::new(muxer)))
.boxed();

Expand Down

0 comments on commit 300dc94

Please sign in to comment.