cuprate icon indicating copy to clipboard operation
cuprate copied to clipboard

P2P Client Pool

Open Boog900 opened this issue 9 months ago • 2 comments

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.

Boog900 avatar Apr 30 '24 01:04 Boog900

@hinto-janai this is ready but will wait for CI #127

Boog900 avatar May 14 '24 12:05 Boog900

@Boog900 re-run CI?

hinto-janai avatar May 14 '24 19:05 hinto-janai

Oh wait you approved it last time, my bad,

Boog900 avatar May 17 '24 13:05 Boog900