What is the best way to ensure at most one connection per peerID? #6131
-
If I want to have at most one connection per peerID, what is the best/easiest way to achieve that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think |
Beta Was this translation helpful? Give feedback.
I think
libp2p-connection-limits
allow you to have an established connection per peer as well if you wish to give that a try, but you can create a behaviour that tracks the connections per peer and if there is any pending connections while there is also an existing connection from said peer, you can deny it. Although, you might want to keep in mind that if you are using a relay connection with dcutr you would likely have two connections with one being via relay and the other being a direct connection (the relay connection should eventually drop depending on configuration).