rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

Allow to read current connection limits

Open dignifiedquire opened this issue 3 years ago • 2 comments

Currently it is possible to get to the ConnectionLimits struct for the current swarm, but it is not possible to read the actual limits, which would be useful to for components that want to check how close to the limit the current state is.

Bonus: It might be nice if there were some methods like has_reached_outgoing_connection_limit for more explicit checks.

dignifiedquire avatar Aug 10 '22 15:08 dignifiedquire

Perhaps we should report the limit with each new connection?

thomaseizinger avatar Aug 11 '22 06:08 thomaseizinger

I would welcome any patches for this.

In case anyone is looking into it, I am currently working on a proposal for generic connection management, i.e. the ability for users to implement their own connection management (e.g. limiting) mechanism. I have not yet published this work.

See also https://github.com/libp2p/rust-libp2p/discussions/2118#discussioncomment-3134752

mxinden avatar Aug 15 '22 15:08 mxinden

Tracking issue for the above mentioned effort: https://github.com/libp2p/rust-libp2p/issues/2824

First draft: https://github.com/libp2p/rust-libp2p/pull/2828

mxinden avatar Oct 05 '22 20:10 mxinden

Connection limits are now a completely standalone component implemented as NetworkBehaviour. It does currently not expose this functionality but that could easily be added. If really necessary, the behaviour can be forked. Thus closing this issue.

If desired, patches to expose ConnectionLimits are welcome.

thomaseizinger avatar Jun 15 '23 21:06 thomaseizinger