mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-19 13:01:22 +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:
@ -28,7 +28,7 @@ use libp2p::kad::record::store::MemoryStore;
|
||||
use libp2p::kad::{GetClosestPeersError, Kademlia, KademliaConfig, KademliaEvent, QueryResult};
|
||||
use libp2p::{
|
||||
development_transport, identity,
|
||||
swarm::{Swarm, SwarmEvent},
|
||||
swarm::{SwarmBuilder, SwarmEvent},
|
||||
PeerId,
|
||||
};
|
||||
use std::{env, error::Error, time::Duration};
|
||||
@ -66,7 +66,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
behaviour.add_address(&peer.parse()?, "/dnsaddr/bootstrap.libp2p.io".parse()?);
|
||||
}
|
||||
|
||||
Swarm::with_async_std_executor(transport, behaviour, local_peer_id)
|
||||
SwarmBuilder::with_async_std_executor(transport, behaviour, local_peer_id).build()
|
||||
};
|
||||
|
||||
// Order Kademlia to search for a peer.
|
||||
|
Reference in New Issue
Block a user