Manages the set of known peer addresses (the address manager).

Synopsis

Declared in <addrman.h>

class AddrMan;

Member Functions

Name

Description

AddrMan [constructor]

Constructs an address manager over the given network group mapping.

~AddrMan [destructor]

Destroys the address manager and its underlying tables.

Add

Attempt to add one or more addresses to addrman's new table. If an address already exists in addrman, the existing entry may be updated (e.g. adding additional service flags). If the existing entry is in the new table, it may be added to more buckets, improving the probability of selection.

Attempt

Mark an entry as connection attempted to.

Connected

We have successfully connected to this peer. Calling this function updates the CAddress's nTime, which is used in our IsTerrible() decisions and gossiped to peers. Callers should be careful that updating this information doesn't leak topology information to network spies.

FindAddressEntry

Test‐only function Find the address record in AddrMan and return information about its position.

GetAddr

Return all or many randomly selected addresses, optionally by network.

GetEntries

Returns an information‐location pair for all addresses in the selected addrman table. If an address appears multiple times in the new table, an information‐location pair is returned for each occurrence. Addresses only ever appear once in the tried table.

Good

Mark an address record as accessible and attempt to move it to addrman's tried table.

ResolveCollisions

See if any to‐be‐evicted tried table entries have been tested and if so resolve the collisions.

Select

Choose an address to connect to.

SelectTriedCollision

Randomly select an address in the tried table that another address is attempting to evict.

Serialize

Serializes the entire address manager state to a stream.

SetServices

Update an entry's service bits.

Size

Return size information about addrman.

Unserialize

Deserializes the address manager state from a stream.

Protected Data Members

Name

Description

m_impl

Owning pointer to the private implementation holding the address tables.

Non-Member Functions

Name

Description

EnsureAddrman

Get the address manager from a node context, asserting it is present.

EnsureAnyAddrman

Get the address manager from an opaque RPC context, asserting it is present.

ReadFromStream

Reads peer addresses from a stream into the address manager.

Created with MrDocs