cuprate
cuprate copied to clipboard
P2P Client Pool
This PR adds the ClientPool
and connection maintainer task.
Client Pool
The client pool replaces what the peer-set was supposed to be. The PeerSet
was a tower::Service
that held the connected peers, allowing the routing methods to retrieve peers from it. However it had notable overhead and giving peers back to it was not simple.
The client pool instead is a wrapper around a DashMap
this should make it quicker to retrieve peers from than the peer set. Although it does make it a bit more complicated to remove disconnected peers from, which is handled by the disconnect_monitor
task.
A worry with both designs PeerSet
and ClientPool
is that only one router can hold a peer at once, i.e while a peer is being used it can not be used by another router. If this becomes a problem we can change it so we can share peers, however I do not see this being a big issue.
@hinto-janai this is ready but will wait for CI #127
@Boog900 re-run CI?
Oh wait you approved it last time, my bad,