diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 1a8d7d8261d..c0437d9eafc 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.25.1 [2020-11-26] + +- Add `ExpandedSwarm::is_connected`. + [PR 1862](https://github.com/libp2p/rust-libp2p/pull/1862). + # 0.25.0 [2020-11-25] - Permit a configuration override for the substream upgrade protocol diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index ca527aabe95..7c82ff67d67 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-swarm" edition = "2018" description = "The libp2p swarm" -version = "0.25.0" +version = "0.25.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index af3ccb71bcb..7b00cfbd46a 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -463,6 +463,11 @@ where TBehaviour: NetworkBehaviour, me.banned_peers.remove(&peer_id); } + /// Checks whether the [`Network`] has an established connection to a peer. + pub fn is_connected(me: &Self, peer_id: &PeerId) -> bool { + me.network.is_connected(peer_id) + } + /// Returns the next event that happens in the `Swarm`. /// /// Includes events from the `NetworkBehaviour` but also events about the connections status.