mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 15:21:33 +00:00
core/src/transport: Poll Transport directly, remove Transport::Listener (#2652)
Remove the concept of individual `Transport::Listener` streams from `Transport`. Instead the `Transport` is polled directly via `Transport::poll`. The `Transport` is now responsible for driving its listeners.
This commit is contained in:
@ -44,10 +44,11 @@ use libp2p::{
|
||||
noise, ping,
|
||||
pnet::{PnetConfig, PreSharedKey},
|
||||
swarm::{NetworkBehaviourEventProcess, SwarmEvent},
|
||||
tcp::TcpConfig,
|
||||
tcp::TcpTransport,
|
||||
yamux::YamuxConfig,
|
||||
Multiaddr, NetworkBehaviour, PeerId, Swarm, Transport,
|
||||
};
|
||||
use libp2p_tcp::GenTcpConfig;
|
||||
use std::{env, error::Error, fs, path::Path, str::FromStr, time::Duration};
|
||||
|
||||
/// Builds the transport that serves as a common ground for all connections.
|
||||
@ -61,7 +62,7 @@ pub fn build_transport(
|
||||
let noise_config = noise::NoiseConfig::xx(noise_keys).into_authenticated();
|
||||
let yamux_config = YamuxConfig::default();
|
||||
|
||||
let base_transport = TcpConfig::new().nodelay(true);
|
||||
let base_transport = TcpTransport::new(GenTcpConfig::default().nodelay(true));
|
||||
let maybe_encrypted = match psk {
|
||||
Some(psk) => EitherTransport::Left(
|
||||
base_transport.and_then(move |socket, _| PnetConfig::new(psk).handshake(socket)),
|
||||
|
Reference in New Issue
Block a user