Skip to content

Commit a4220eb

Browse files
authored
feat(swarm-test): remove async-std support
Remove support for `async_std` in `swarm-test`. Pull-Request: #6064.
1 parent 5e413c3 commit a4220eb

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

swarm-test/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
- Default to `tokio` runtime.
44
See [PR 6024](https://github.com/libp2p/rust-libp2p/pull/6024).
5+
- Remove `async_std` runtime support with `Swarm::new_ephemeral`.
6+
Use `Swarm::new_ephemeral_tokio` instead.
7+
See [PR 6064](https://github.com/libp2p/rust-libp2p/pull/6064)
58

69
## 0.5.0
710

swarm-test/src/lib.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ use libp2p_swarm::{
3838
pub trait SwarmExt {
3939
type NB: NetworkBehaviour;
4040

41-
/// Create a new [`Swarm`] with an ephemeral identity and the `async-std` runtime.
42-
///
43-
/// The swarm will use a [`libp2p_core::transport::MemoryTransport`] together with a
44-
/// [`libp2p_plaintext::Config`] authentication layer and [`libp2p_yamux::Config`] as the
45-
/// multiplexer. However, these details should not be relied
46-
/// upon by the test and may change at any time.
47-
#[cfg(feature = "async-std")]
48-
fn new_ephemeral(behaviour_fn: impl FnOnce(libp2p_identity::Keypair) -> Self::NB) -> Self
49-
where
50-
Self: Sized;
51-
5241
/// Create a new [`Swarm`] with an ephemeral identity and the `tokio` runtime.
5342
///
5443
/// The swarm will use a [`libp2p_core::transport::MemoryTransport`] together with a
@@ -223,33 +212,6 @@ where
223212
{
224213
type NB = B;
225214

226-
#[cfg(feature = "async-std")]
227-
fn new_ephemeral(behaviour_fn: impl FnOnce(libp2p_identity::Keypair) -> Self::NB) -> Self
228-
where
229-
Self: Sized,
230-
{
231-
use libp2p_core::{transport::MemoryTransport, upgrade::Version, Transport as _};
232-
use libp2p_identity::Keypair;
233-
234-
let identity = Keypair::generate_ed25519();
235-
let peer_id = PeerId::from(identity.public());
236-
237-
let transport = MemoryTransport::default()
238-
.or_transport(libp2p_tcp::async_io::Transport::default())
239-
.upgrade(Version::V1)
240-
.authenticate(libp2p_plaintext::Config::new(&identity))
241-
.multiplex(libp2p_yamux::Config::default())
242-
.timeout(Duration::from_secs(20))
243-
.boxed();
244-
245-
Swarm::new(
246-
transport,
247-
behaviour_fn(identity),
248-
peer_id,
249-
libp2p_swarm::Config::with_async_std_executor(),
250-
)
251-
}
252-
253215
#[cfg(feature = "tokio")]
254216
fn new_ephemeral_tokio(behaviour_fn: impl FnOnce(libp2p_identity::Keypair) -> Self::NB) -> Self
255217
where

0 commit comments

Comments
 (0)