PeerRegistry
PeerRegistry: the net-kernel's one-connection-per-peer table.
After a successful handshake, a peer is registered under its NodeId along with the socket fd of its connection. Re-registering the same NodeId replaces the prior entry (the newer connection wins) — so there is at most one live connection per peer, the invariant the L2 net-kernel maintains.
Types
fd is the CONTROL connection; data_fd the data one, -1 until it is up (a pre-split peer never opens one). See the control/data split in specs/progress/2026-09-14-distributed-plane-flow-control-and-control-channel.md.
Functions
Register [peer] under its node_id, replacing any existing entry for that node (the newer connection wins).
Attach the data connection [data_fd] to the already-registered peer [node_id], replacing any previous data fd. Returns Err if [node_id] is not registered.
Whether a peer is registered under [node_id].
Whether [p] has a data connection (its data_fd is not no_fd()).
The peer registered under [node_id], or None.
The sentinel fd (-1) meaning "no connection", used for data_fd until a peer's data connection is up.
Drop the entry for [node_id]; the table is unchanged if it has none. The connections are not closed.