Manages all P2P connections: opening, accepting, servicing and tearing them down.
Synopsis
Declared in <net.h>
class CConnman;
Types
Name |
Description |
Configuration options used to start a CConnman. |
|
Group of private broadcast related members. |
Type Aliases
Name |
Description |
Callback type invoked for each node by ForEachNode. |
Member Functions
Name |
Description |
|
Construct a connection manager with the given randomness seeds and dependencies. |
|
Destroy the connection manager, stopping any remaining activity. |
Log a warning if the configured ASMap looks unhealthy. |
|
Attempts to open a connection. Currently only used from tests. |
|
Updates the local services that this node advertises to other peers during connection handshake. |
|
Add a manually added node, returning false if it was already present. |
|
Return whether the given address matches one of the manually added nodes. |
|
Return whether the given nonce differs from every outbound connection's local nonce. |
|
|
|
If we are at capacity for inbound tx‐relay peers, attempt to evict one. |
|
|
|
Invoke a callback on the node with the given id, if it is fully connected. |
|
Return connection info for all manually added nodes. |
|
Return addresses from the per‐requestor cache. If no cache entry exists, it is populated with randomly selected addresses. This function can be used in untrusted contexts. |
|
Return randomly selected addresses. This function does not use the address response cache and should only be used in trusted contexts. |
|
Get a unique deterministic randomizer. |
|
Return the number of block‐relay‐only peers we have over our limit. |
|
Return the number of outbound peers we have in excess of our target. |
|
Return the number of full‐relay outbound peers we have. |
|
Used to convey which local services we are offering peers during node connection. |
|
Return the autonomous system number the given address maps to. |
|
Return the configured maximum number of bytes to upload per cycle (0 = unlimited). |
|
Return the time left in the current max‐outbound cycle (0 if there is no limit). |
|
Return the length of a max‐outbound cycle. |
|
Return whether networking is currently active. |
|
Return the number of connections in the given direction (inbound, outbound, or both). |
|
Collect per‐peer statistics into the given vector. |
|
Return the mutex guarding the node list (for thread‐safety annotations only). |
|
response the bytes left in the current max outbound cycle in case of no limit, it will always response 0 |
|
Return the total number of bytes received across all connections. |
|
Return the total number of bytes sent across all connections. |
|
Return whether we are currently trying to open an extra outbound peer. |
|
Return whether outgoing peers are selected via the address manager. |
|
Apply the given options to this connection manager. |
|
Interrupt any blocking operations so the manager can shut down. |
|
Return whether we have more than one manual or full‐relay connection to the given network. |
|
Open a new P2P connection and initialize it with the PeerManager at |
|
check if the outbound target is reached if param historicalBlockServingLimit is set true, the function will response true if the limit for serving historical blocks has been reached |
|
Queue a serialized message to be sent to the given node. |
|
Remove a manually added node, returning false if it was not present. |
|
Removes service flags from the ones this node advertises to peers. |
|
Enable or disable message capture (test only). |
|
Enable or disable networking activity. |
|
Set whether to try opening an extra outbound peer beyond the normal target. |
|
Return true if we should disconnect the peer for failing an inactivity check. |
|
Start the connection manager and its worker threads. |
|
Begin opening extra block‐relay‐only peer connections. |
|
Stop the connection manager: stop the threads, then the nodes. |
|
Disconnect and delete all nodes. |
|
Stop and join all worker threads. |
|
Wake the message handling thread so it processes pending work. |
|
Return a copy of our known local addresses and their service info. |
Data Members
Name |
Description |
Group of private broadcast related members. |
Friends
Name |
Description |
Test harness that exposes CConnman internals for unit tests. |
Non-Member Functions
Name |
Description |
Get the connection manager from a node context, asserting it is present. |
Created with MrDocs