diff --git a/Cargo.lock b/Cargo.lock index fc9bf4cab50..c7a5775b18f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2510,7 +2510,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.3.0" +version = "0.3.1" dependencies = [ "async-std", "libp2p-core", diff --git a/Cargo.toml b/Cargo.toml index 00aa66625cb..11ac47b0be4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ futures-bounded = { version = "0.2.3", path = "misc/futures-bounded" } libp2p = { version = "0.53.2", path = "libp2p" } libp2p-allow-block-list = { version = "0.3.0", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.12.0", path = "protocols/autonat" } -libp2p-connection-limits = { version = "0.3.0", path = "misc/connection-limits" } +libp2p-connection-limits = { version = "0.3.1", path = "misc/connection-limits" } libp2p-core = { version = "0.41.2", path = "core" } libp2p-dcutr = { version = "0.11.0", path = "protocols/dcutr" } libp2p-dns = { version = "0.41.1", path = "transports/dns" } diff --git a/misc/connection-limits/CHANGELOG.md b/misc/connection-limits/CHANGELOG.md index a5b68a6f51b..4654281a83e 100644 --- a/misc/connection-limits/CHANGELOG.md +++ b/misc/connection-limits/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.1 + +- Add function to mutate `ConnectionLimits`. + See [PR 4964](https://github.com/libp2p/rust-libp2p/pull/4964). + ## 0.3.0 diff --git a/misc/connection-limits/Cargo.toml b/misc/connection-limits/Cargo.toml index 2aa26ad44f1..8ecb0005cb1 100644 --- a/misc/connection-limits/Cargo.toml +++ b/misc/connection-limits/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-connection-limits" edition = "2021" rust-version = { workspace = true } description = "Connection limits for libp2p." -version = "0.3.0" +version = "0.3.1" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/misc/connection-limits/src/lib.rs b/misc/connection-limits/src/lib.rs index cb12599ad79..dbe68a8ad11 100644 --- a/misc/connection-limits/src/lib.rs +++ b/misc/connection-limits/src/lib.rs @@ -79,6 +79,12 @@ impl Behaviour { established_per_peer: Default::default(), } } + + /// Returns a mutable reference to [`ConnectionLimits`]. + /// > **Note**: A new limit will not be enforced against existing connections. + pub fn limits_mut(&mut self) -> &mut ConnectionLimits { + &mut self.limits + } } fn check_limit(limit: Option, current: usize, kind: Kind) -> Result<(), ConnectionDenied> {