mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-02 19:21:37 +00:00
feat(swarm): enforce creation of Swarm
via SwarmBuilder
Mark constructors `Swarm::with_X_executor` as deprecated. Move the deprecated functionality to `SwarmBuilder::with_X_executor` Use `SwarmBuilder` throughout. Resolves #3186. Resolves #3107. Pull-Request: #3588.
This commit is contained in:
@ -4,7 +4,7 @@ use libp2p_core::muxing::StreamMuxerBox;
|
||||
use libp2p_core::Transport;
|
||||
use libp2p_identity as identity;
|
||||
use libp2p_ping as ping;
|
||||
use libp2p_swarm::{keep_alive, NetworkBehaviour, Swarm};
|
||||
use libp2p_swarm::{keep_alive, NetworkBehaviour, Swarm, SwarmBuilder};
|
||||
use rand::thread_rng;
|
||||
use void::Void;
|
||||
|
||||
@ -33,11 +33,7 @@ fn create_swarm() -> Result<Swarm<Behaviour>> {
|
||||
.map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn)))
|
||||
.boxed();
|
||||
|
||||
Ok(Swarm::with_tokio_executor(
|
||||
transport,
|
||||
Behaviour::default(),
|
||||
peer_id,
|
||||
))
|
||||
Ok(SwarmBuilder::with_tokio_executor(transport, Behaviour::default(), peer_id).build())
|
||||
}
|
||||
|
||||
#[derive(NetworkBehaviour, Default)]
|
||||
|
Reference in New Issue
Block a user