mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-26 08:11:39 +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:
@ -32,7 +32,7 @@ use libp2p::noise;
|
||||
use libp2p::ping::{Ping, PingConfig, PingEvent};
|
||||
use libp2p::relay::v2::client::{self, Client};
|
||||
use libp2p::swarm::{SwarmBuilder, SwarmEvent};
|
||||
use libp2p::tcp::TcpConfig;
|
||||
use libp2p::tcp::{GenTcpConfig, TcpTransport};
|
||||
use libp2p::Transport;
|
||||
use libp2p::{identity, NetworkBehaviour, PeerId};
|
||||
use log::info;
|
||||
@ -95,7 +95,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let transport = OrTransport::new(
|
||||
relay_transport,
|
||||
block_on(DnsConfig::system(TcpConfig::new().port_reuse(true))).unwrap(),
|
||||
block_on(DnsConfig::system(TcpTransport::new(
|
||||
GenTcpConfig::default().port_reuse(true),
|
||||
)))
|
||||
.unwrap(),
|
||||
)
|
||||
.upgrade(upgrade::Version::V1)
|
||||
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
|
||||
|
Reference in New Issue
Block a user