mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-30 18:21:33 +00:00
[core/swarm] Refactor and extend configurable connection limits. (#1848)
* Refactor and extend configurable connection limits. To better track different connection counts, permit configurable limits for these counts and make these available for inspection efficiently, introduce dedicated connection counters via a `ConnectionCounters` structure that is exposed on the API via the `NetworkInfo`. All connection or connection states that are counted in this way can also have effective configurable limits. * Cleanup * Add missing file. * Refine naming and config API. * Update core/CHANGELOG.md Co-authored-by: Max Inden <mail@max-inden.de> * Update core/CHANGELOG.md Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -32,6 +32,7 @@ pub use listeners::{ListenerId, ListenersStream, ListenersEvent};
|
||||
pub use manager::ConnectionId;
|
||||
pub use substream::{Substream, SubstreamEndpoint, Close};
|
||||
pub use pool::{EstablishedConnection, EstablishedConnectionIter, PendingConnection};
|
||||
pub use pool::{ConnectionLimits, ConnectionCounters};
|
||||
|
||||
use crate::muxing::StreamMuxer;
|
||||
use crate::{Multiaddr, PeerId};
|
||||
@ -326,9 +327,9 @@ impl<'a> OutgoingInfo<'a> {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ConnectionLimit {
|
||||
/// The maximum number of connections.
|
||||
pub limit: usize,
|
||||
pub limit: u32,
|
||||
/// The current number of connections.
|
||||
pub current: usize,
|
||||
pub current: u32,
|
||||
}
|
||||
|
||||
impl fmt::Display for ConnectionLimit {
|
||||
|
Reference in New Issue
Block a user