Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Rework peer connections #412

@gavofyork

Description

@gavofyork

Avoid the 32-second "try to connect to some nodes" construct.

Instead:

  • Split the peer slots into three parts:
    • Reserved (peers that have been passed by the --reserved flag - they get their own special slots and should be continuously, though responsibly, (re)connected to)
    • Outgoing (number of slots == min_peers, these are connections to nodes that we discover/remember and initiate)
    • Incoming (number of slots == max_peers - min_peers, these are inbound connections from nodes that have discovered us)

Regarding Outgoing peers:

  • We start by connecting to up to min_peers nodes; they each take a slot in our Outgoing peer table.
  • We attempt to connect to a (/the highest scoring, once reputation system is done) node when one of the following happens:
    • A previous connection to a node has failed.
    • A peer who was in the Outgoing table has been/become disconnected.
    • We have discovered new nodes and have slots free in the Outgoing peer table.
    • The backoff timer of a previous node has expired and we can retry connecting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I4-annoyanceThe client behaves within expectations, however this “expected behaviour” itself is at issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions