Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d9d98ae
deprecate async_std support in TCP crate
gitToki Mar 25, 2025
d631545
tokio not default
gitToki Mar 25, 2025
1beb916
Merge branch 'master' into TCP
gitToki Mar 25, 2025
5147a19
Merge branch 'master' into TCP
gitToki Mar 26, 2025
e3a4271
Merge branch 'master' into TCP
jxs Apr 3, 2025
bbe06f2
Merge branch 'libp2p:master' into TCP
gitToki Apr 13, 2025
8218394
update tcp crate
Apr 13, 2025
f8e5843
update tcp crate
Apr 13, 2025
3bf2111
update lib rs
Apr 13, 2025
68856ee
re-update lib rs
Apr 13, 2025
314b972
update TCP crate
Apr 29, 2025
096b242
async ref in websocket toml
Apr 29, 2025
bee4d48
Merge branch 'master' into TCP
gitToki Jun 4, 2025
822c060
update test / cargo
Jun 4, 2025
0c7951e
changelog
Jun 4, 2025
09f8ede
update changelog
Jun 4, 2025
bb8d7fa
update changelog / swarm test version / test
Jun 4, 2025
1f6883c
fmt
Jun 4, 2025
79aec61
update test - swarm - changelog
Jun 5, 2025
2c2a167
update cargo websocket / fmt
Jun 5, 2025
61a1138
remove version bump and remove curly brackets
Jun 7, 2025
4b38073
undo websocket
Jun 7, 2025
8a9d2d2
libp2p websocket v
Jun 7, 2025
8f89e1e
Merge branch 'master' into TCP
gitToki Jun 10, 2025
8e79761
clippy
gitToki Jun 10, 2025
d01ed8b
revert dcutr version bump
gitToki Jun 10, 2025
0331be8
new ephemeral / update changelog
gitToki Jun 13, 2025
d5478e5
Merge branch 'master' of github.com:libp2p/rust-libp2p into TCP
jxs Jun 24, 2025
83029e4
update Cargo.lock
jxs Jun 24, 2025
16b8d21
address merge leftovers
jxs Jun 24, 2025
6db1a19
address merge leftovers
jxs Jun 24, 2025
110c1a3
address merge leftovers
jxs Jun 24, 2025
c0f1be7
do not set tokio as default
jxs Jun 24, 2025
e55318b
address merge leftovers
jxs Jun 24, 2025
4dfe37e
address merge leftovers
jxs Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions transports/tcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
async-io = { version = "2.3.3", optional = true }
futures = { workspace = true }
futures-timer = "3.0"
if-watch = { workspace = true }
Expand All @@ -23,10 +22,8 @@ tracing = { workspace = true }

[features]
tokio = ["dep:tokio", "if-watch/tokio"]
async-io = ["dep:async-io", "if-watch/smol"]

[dev-dependencies]
async-std = { version = "1.6.5", features = ["attributes"] }
tokio = { workspace = true, features = ["full"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

Expand Down
68 changes: 2 additions & 66 deletions transports/tcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
//!
//! # Usage
//!
//! This crate provides a [`async_io::Transport`] and [`tokio::Transport`], depending on
//! the enabled features, which implement the [`libp2p_core::Transport`] trait for use as a
//! This crate provides [`tokio::Transport`]
//! which implement the [`libp2p_core::Transport`] trait for use as a
//! transport with `libp2p-core` or `libp2p-swarm`.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
Expand All @@ -47,8 +47,6 @@ use libp2p_core::{
multiaddr::{Multiaddr, Protocol},
transport::{DialOpts, ListenerId, PortUse, TransportError, TransportEvent},
};
#[cfg(feature = "async-io")]
pub use provider::async_io;
#[cfg(feature = "tokio")]
pub use provider::tokio;
use provider::{Incoming, Provider};
Expand Down Expand Up @@ -225,7 +223,6 @@ impl Default for Config {
/// You shouldn't need to use this type directly. Use one of the following instead:
///
/// - [`tokio::Transport`]
/// - [`async_io::Transport`]
pub struct Transport<T>
where
T: Provider + Send,
Expand Down Expand Up @@ -254,7 +251,6 @@ where
/// It is best to call this function through one of the type-aliases of this type:
///
/// - [`tokio::Transport::new`]
/// - [`async_io::Transport::new`]
pub fn new(config: Config) -> Self {
Transport {
config,
Expand Down Expand Up @@ -809,16 +805,6 @@ mod tests {
}

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
let listener = listener::<async_io::Tcp>(addr.clone(), ready_tx);
let dialer = dialer::<async_io::Tcp>(ready_rx);
let listener = async_std::task::spawn(listener);
async_std::task::block_on(dialer);
async_std::task::block_on(listener);
}

#[cfg(feature = "tokio")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
Expand Down Expand Up @@ -889,16 +875,6 @@ mod tests {
}

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
let listener = listener::<async_io::Tcp>(addr.clone(), ready_tx);
let dialer = dialer::<async_io::Tcp>(ready_rx);
let listener = async_std::task::spawn(listener);
async_std::task::block_on(dialer);
async_std::task::block_on(listener);
}

#[cfg(feature = "tokio")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
Expand Down Expand Up @@ -1006,17 +982,6 @@ mod tests {
}

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
let (port_reuse_tx, port_reuse_rx) = oneshot::channel();
let listener = listener::<async_io::Tcp>(addr.clone(), ready_tx, port_reuse_rx);
let dialer = dialer::<async_io::Tcp>(addr.clone(), ready_rx, port_reuse_tx);
let listener = async_std::task::spawn(listener);
async_std::task::block_on(dialer);
async_std::task::block_on(listener);
}

#[cfg(feature = "tokio")]
{
let (ready_tx, ready_rx) = mpsc::channel(1);
Expand Down Expand Up @@ -1074,12 +1039,6 @@ mod tests {
}

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let listener = listen_twice::<async_io::Tcp>(addr.clone());
async_std::task::block_on(listener);
}

#[cfg(feature = "tokio")]
{
let listener = listen_twice::<tokio::Tcp>(addr);
Expand Down Expand Up @@ -1110,12 +1069,6 @@ mod tests {
}

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let new_addr = async_std::task::block_on(listen::<async_io::Tcp>(addr.clone()));
assert!(!new_addr.to_string().contains("tcp/0"));
}

#[cfg(feature = "tokio")]
{
let rt = ::tokio::runtime::Builder::new_current_thread()
Expand All @@ -1138,12 +1091,6 @@ mod tests {
.try_init();

fn test(addr: Multiaddr) {
#[cfg(feature = "async-io")]
{
let mut tcp = async_io::Transport::default();
assert!(tcp.listen_on(ListenerId::next(), addr.clone()).is_err());
}

#[cfg(feature = "tokio")]
{
let mut tcp = tokio::Transport::default();
Expand All @@ -1168,11 +1115,6 @@ mod tests {
tcp.remove_listener(listener_id)
}

#[cfg(feature = "async-io")]
{
assert!(async_std::task::block_on(cycle_listeners::<async_io::Tcp>()));
}

#[cfg(feature = "tokio")]
{
let rt = ::tokio::runtime::Builder::new_current_thread()
Expand Down Expand Up @@ -1203,12 +1145,6 @@ mod tests {
)
.unwrap();
}
#[cfg(feature = "async-io")]
{
async_std::task::block_on(async {
test::<async_io::Tcp>();
})
}
#[cfg(feature = "tokio")]
{
let rt = ::tokio::runtime::Builder::new_current_thread()
Expand Down
3 changes: 0 additions & 3 deletions transports/tcp/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@

//! The interface for providers of non-blocking TCP implementations.

#[cfg(feature = "async-io")]
pub mod async_io;

#[cfg(feature = "tokio")]
pub mod tokio;

Expand Down
127 changes: 0 additions & 127 deletions transports/tcp/src/provider/async_io.rs

This file was deleted.