mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +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:
@ -40,7 +40,7 @@ use futures::prelude::*;
|
||||
use libp2p::{
|
||||
core::{multiaddr::Multiaddr, upgrade::Version},
|
||||
identify, identity, noise,
|
||||
swarm::{Swarm, SwarmEvent},
|
||||
swarm::{SwarmBuilder, SwarmEvent},
|
||||
tcp, yamux, PeerId, Transport,
|
||||
};
|
||||
use std::error::Error;
|
||||
@ -63,7 +63,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
local_key.public(),
|
||||
));
|
||||
|
||||
let mut swarm = Swarm::with_async_std_executor(transport, behaviour, local_peer_id);
|
||||
let mut swarm =
|
||||
SwarmBuilder::with_async_std_executor(transport, behaviour, local_peer_id).build();
|
||||
|
||||
// Tell the swarm to listen on all interfaces and a random, OS-assigned
|
||||
// port.
|
||||
|
Reference in New Issue
Block a user