Skip to content

Reliable clients#199

Open
kalabukdima wants to merge 5 commits intomainfrom
kalabukdima/reliable-clients
Open

Reliable clients#199
kalabukdima wants to merge 5 commits intomainfrom
kalabukdima/reliable-clients

Conversation

@kalabukdima
Copy link
Copy Markdown
Collaborator

Instead of capturing dial attempts and triggering Kademlia lookups (taking multiple seconds), make the clients (portal, pings collector, etc) keep the connections to the workers always open. This way the substream is either opened quickly or fails to open allowing the portal to pick another worker.
This saves query time and also makes the transport more robust by avoiding spamming extra kademlia lookups under the load.

- stop intercepting dial attempts by the stream behaviour
- immediately reject stream if a connection can't be established
- run lookups in the background to establish connections with all
  workers
@kalabukdima kalabukdima requested a review from denisbsu March 11, 2026 12:27
}

while self.ongoing_lookups.len() < self.max_concurrent_lookups {
let Some(peer_id) = self.pending_lookups.pop_front() else {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably it's better to move condition into while to make code more understandable.

break;
};
if !self.outbound_conn_exists(&peer_id) {
self.find_and_dial(peer_id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment about find_and_dial also managing ongoing_lookups would fit here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants