Skip to content

Limit the initial crawler demand for outbound peers, based on seed peer connections #2902

Closed

Description

Motivation

When Zebra starts up, the crawler task tries to dial peerset_initial_target_size peers. This is in addition to the peerset_initial_target_size peers from the initial seed peer connection limit.

But we only want peerset_initial_target_size initial peers, not peerset_initial_target_size * 2 initial peers. In PR #2944, this extra demand gets dropped, but it's a small waste of CPU and RAM.

Suggested Design

Initialize the peer connection count demand_tx in peer_set::initialize based on the number of connections made in add_initial_peers.

Edge Cases

The initial peer limit counts connection attempts. But the connection limit is for open connections. So we have to count the right thing here.

We should make sure the calculation doesn't underflow and panic.

Related Work

These tickets might modify the same functions as this ticket:

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

Metadata

Assignees

Labels

A-networkArea: Network protocol updates or fixes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions