On connection management #2118
Replies: 4 comments 12 replies
-
Agreed that there is room for improvement on address management in rust-libp2p. A couple of follow-ups to the suggestions above:
That would be a cool feature for the address book, indeed.
Agreed, that this is less than ideal for |
Beta Was this translation helpful? Give feedback.
-
Regarding this:
What are your thoughts on introducing something like Alternatively, we could do the same thing we do for substreams ( |
Beta Was this translation helpful? Give feedback.
-
Following up on this discussion, though with a slight change of theme. Today a user can:
A user is restricted in (1) as they can not do anything beyond setting upper bound limits. E.g. they can not decide whether to accept or deny an incoming connection based on the IP, the Say we would introduce a mechanism for a user to make these decisions (while still offering a default), the only open question for me is whether the user can decide in a synchronous fashion, or whether they would need an asynchronous communication style. To be more concrete, when provided with the ask to accept or deny an incoming connection, can the user respond directly, or would the user need an asynchronous mechanism? @AgeManning @divagant-martian What would you need to make connection management in lighthouse simpler? Would the connection management logic be able to make a synchronous decision, or does it need to communicate with another component in an asynchronous fashion (e.g. through a channel) to make the decision? @dignifiedquire would you be able to make such decision in iroh in a synchronous fashion? |
Beta Was this translation helpful? Give feedback.
-
For us (which is likely quite specific to our design) our connection management is handled via mutexes, so we can obtain a result synchronously. This feature would be a nice-to-have for us because, as you've mentioned we currently lack the ability to accept/deny incoming connections on other heuristics. We still currently do this, but we do this at a higher level, once the connection is established (or via the swarm banning mechanism) if we don't want to accept connections from specific peer-ids. So for us, synchronous is fine. |
Beta Was this translation helpful? Give feedback.
-
At the moment, implementations of
NetworkBehaviour
always need to implement their own connection management.I'd like discuss how we can improve this situation.
NetworkBehaviourAction::NotifyHandler
silently drops an event if no connection exists. As we can see fromlibp2p-request-response
, there is clearly a demand for functionality a la "send this message, if no connection exists, make a new one".There is no concept of an "Address Book" on the
Swarm
level. Often times, it would be nice if we could feed theSwarm
with a mapping ofPeerId
s andMultiaddr
that would be taken into account when dialing peers. We might even want to go as far as using a similar mechanism as was taken for external addresses and entirely removeaddresses_of_peer
fromNetworkBehaviour
in favor of aNetworkBehaviourAction
whereNetworkBehaviour
s can inform theSwarm
about new addresses they discovered. Internally, theSwarm
would keep all these addresses and score them. I think it would also be useful if there was an easy way of dumping and restoring that information so it can be persisted between restarts.Beta Was this translation helpful? Give feedback.
All reactions