mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 01:31:33 +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,8 @@ use libp2p_core::{
|
||||
use libp2p_identity::PeerId;
|
||||
use libp2p_plaintext::PlainText2Config;
|
||||
use libp2p_swarm::{
|
||||
dial_opts::DialOpts, AddressScore, NetworkBehaviour, Swarm, SwarmEvent, THandlerErr,
|
||||
dial_opts::DialOpts, AddressScore, NetworkBehaviour, Swarm, SwarmBuilder, SwarmEvent,
|
||||
THandlerErr,
|
||||
};
|
||||
use libp2p_yamux::YamuxConfig;
|
||||
use std::fmt::Debug;
|
||||
@ -218,7 +219,7 @@ where
|
||||
.timeout(Duration::from_secs(20))
|
||||
.boxed();
|
||||
|
||||
Swarm::without_executor(transport, behaviour_fn(identity), peer_id)
|
||||
SwarmBuilder::without_executor(transport, behaviour_fn(identity), peer_id).build()
|
||||
}
|
||||
|
||||
async fn connect<T>(&mut self, other: &mut Swarm<T>)
|
||||
|
Reference in New Issue
Block a user