diff --git a/Cargo.lock b/Cargo.lock index b917d0a96e8..63994b8f8cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3300,7 +3300,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.46.0" +version = "0.46.1" dependencies = [ "async-std", "criterion", diff --git a/Cargo.toml b/Cargo.toml index 0d1880eb2b1..8fca60b82a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" } -libp2p-swarm = { version = "0.46.0", path = "swarm" } +libp2p-swarm = { version = "0.46.1", path = "swarm" } libp2p-swarm-derive = { version = "=0.35.1", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" } libp2p-tcp = { version = "0.43.0", path = "transports/tcp" } diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 70cf10b55e9..b8e7ac135e3 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.46.1 +- Undo `ConnectionHandler::{InboundOpenInfo, OutboundOpenInfo}` deprecation. + Substreams are not completely interchangeable and a certain Substream may be associated with a + certain upgrade. + See [PR 5860](https://github.com/libp2p/rust-libp2p/pull/5860). + ## 0.46.0 - Don't report `NewExternalAddrCandidate` for confirmed external addresses. @@ -12,11 +18,11 @@ - Update default for idle-connection-timeout to 10s. See [PR 4967](https://github.com/libp2p/rust-libp2p/pull/4967). -- Deprecate `ConnectionHandler::{InboundOpenInfo, OutboundOpenInfo}` associated type. - Previously, users could tag pending sub streams with custom data and retrieve the data +- Deprecate `ConnectionHandler::{InboundOpenInfo, OutboundOpenInfo}` associated type. + Previously, users could tag pending sub streams with custom data and retrieve the data after the substream has been negotiated. - But substreams themselves are completely interchangeable, users should instead track - additional data inside `ConnectionHandler` after negotiation. + But substreams themselves are completely interchangeable, users should instead track + additional data inside `ConnectionHandler` after negotiation. See [PR 5242](https://github.com/libp2p/rust-libp2p/pull/5242). diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index b3d2520f97c..17cc2e59cde 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-swarm" edition = "2021" rust-version = { workspace = true } description = "The libp2p swarm" -version = "0.46.0" +version = "0.46.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm/src/behaviour/toggle.rs b/swarm/src/behaviour/toggle.rs index a706187a40c..af2bbe981b7 100644 --- a/swarm/src/behaviour/toggle.rs +++ b/swarm/src/behaviour/toggle.rs @@ -200,7 +200,6 @@ impl ToggleConnectionHandler where TInner: ConnectionHandler, { - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_fully_negotiated_inbound( &mut self, FullyNegotiatedInbound { @@ -232,7 +231,6 @@ where panic!("Unexpected Either::Right in enabled `on_fully_negotiated_inbound`.") } } - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { info, error: err }: ListenUpgradeError< @@ -268,7 +266,6 @@ where } } -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for ToggleConnectionHandler where TInner: ConnectionHandler, diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index bf688f41f0d..a91cd07528b 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -123,7 +123,6 @@ where /// The underlying handler. handler: THandler, /// Futures that upgrade incoming substreams. - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. negotiating_in: FuturesUnordered< StreamUpgrade< THandler::InboundOpenInfo, @@ -132,7 +131,6 @@ where >, >, /// Futures that upgrade outgoing substreams. - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. negotiating_out: FuturesUnordered< StreamUpgrade< THandler::OutboundOpenInfo, @@ -157,7 +155,6 @@ where /// /// The upgrade timeout is already ticking here so this may fail in case the remote is not /// quick enough in providing us with a new stream. - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. requested_substreams: FuturesUnordered< SubstreamRequested, >, @@ -171,7 +168,6 @@ where stream_counter: ActiveStreamCounter, } -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl fmt::Debug for Connection where THandler: ConnectionHandler + fmt::Debug, diff --git a/swarm/src/connection/pool.rs b/swarm/src/connection/pool.rs index f21a7307105..49cc774b2b7 100644 --- a/swarm/src/connection/pool.rs +++ b/swarm/src/connection/pool.rs @@ -553,7 +553,6 @@ where /// Polls the connection pool for events. #[tracing::instrument(level = "debug", name = "Pool::poll", skip(self, cx))] - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. pub(crate) fn poll(&mut self, cx: &mut Context<'_>) -> Poll> where THandler: ConnectionHandler + 'static, diff --git a/swarm/src/handler.rs b/swarm/src/handler.rs index 2eb128d173b..0e4d1f5a325 100644 --- a/swarm/src/handler.rs +++ b/swarm/src/handler.rs @@ -98,7 +98,6 @@ use crate::{connection::AsStrHashEq, StreamProtocol}; /// Implementers of this trait should keep in mind that the connection can be closed at any time. /// When a connection is closed gracefully, the substreams used by the handler may still /// continue reading data until the remote closes its side of the connection. -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. pub trait ConnectionHandler: Send + 'static { /// A type representing the message(s) a /// [`NetworkBehaviour`](crate::behaviour::NetworkBehaviour) can send to a [`ConnectionHandler`] @@ -113,10 +112,8 @@ pub trait ConnectionHandler: Send + 'static { /// The outbound upgrade for the protocol(s) used by the handler. type OutboundProtocol: OutboundUpgradeSend; /// The type of additional information returned from `listen_protocol`. - #[deprecated = "Track data in ConnectionHandler instead."] type InboundOpenInfo: Send + 'static; /// The type of additional information passed to an `OutboundSubstreamRequest`. - #[deprecated = "Track data in ConnectionHandler instead."] type OutboundOpenInfo: Send + 'static; /// The [`InboundUpgrade`](libp2p_core::upgrade::InboundUpgrade) to apply on inbound diff --git a/swarm/src/handler/either.rs b/swarm/src/handler/either.rs index a349726f454..1dc62e0eb2a 100644 --- a/swarm/src/handler/either.rs +++ b/swarm/src/handler/either.rs @@ -77,7 +77,6 @@ where /// Implementation of a [`ConnectionHandler`] that represents either of two [`ConnectionHandler`] /// implementations. -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for Either where L: ConnectionHandler, diff --git a/swarm/src/handler/map_in.rs b/swarm/src/handler/map_in.rs index 7a5166cab75..55885b351bb 100644 --- a/swarm/src/handler/map_in.rs +++ b/swarm/src/handler/map_in.rs @@ -47,7 +47,6 @@ impl MapInEvent ConnectionHandler for MapInEvent where diff --git a/swarm/src/handler/map_out.rs b/swarm/src/handler/map_out.rs index 9bb0e2bc554..6d05551aeec 100644 --- a/swarm/src/handler/map_out.rs +++ b/swarm/src/handler/map_out.rs @@ -43,7 +43,6 @@ impl MapOutEvent { } } -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for MapOutEvent where TConnectionHandler: ConnectionHandler, diff --git a/swarm/src/handler/multi.rs b/swarm/src/handler/multi.rs index 4f4d64f65fe..73af1b1109e 100644 --- a/swarm/src/handler/multi.rs +++ b/swarm/src/handler/multi.rs @@ -86,7 +86,6 @@ where Ok(m) } - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { @@ -108,7 +107,6 @@ where } } -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for MultiHandler where K: Clone + Debug + Hash + Eq + Send + 'static, diff --git a/swarm/src/handler/select.rs b/swarm/src/handler/select.rs index f4c926f1a0e..0f6dbe988ff 100644 --- a/swarm/src/handler/select.rs +++ b/swarm/src/handler/select.rs @@ -152,7 +152,6 @@ where TProto1: ConnectionHandler, TProto2: ConnectionHandler, { - #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { @@ -182,7 +181,6 @@ where } } -#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for ConnectionHandlerSelect where TProto1: ConnectionHandler,