Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | void Init(const Options &connOptions) { | ||||
vAddedNodes = connOptions.m_added_nodes; | vAddedNodes = connOptions.m_added_nodes; | ||||
} | } | ||||
} | } | ||||
CConnman(const Config &configIn, uint64_t seed0, uint64_t seed1); | CConnman(const Config &configIn, uint64_t seed0, uint64_t seed1); | ||||
~CConnman(); | ~CConnman(); | ||||
bool Start(CScheduler &scheduler, const Options &options); | bool Start(CScheduler &scheduler, const Options &options); | ||||
void Stop(); | |||||
// TODO: Remove NO_THREAD_SAFETY_ANALYSIS. Lock cs_vNodes before reading the | |||||
// variable vNodes. | |||||
// | |||||
// When removing NO_THREAD_SAFETY_ANALYSIS be aware of the following lock | |||||
// order requirements: | |||||
// * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling | |||||
// GetExtraOutboundCount which locks cs_vNodes. | |||||
// * ProcessMessage locks cs_main and g_cs_orphans before indirectly calling | |||||
// ForEachNode which locks cs_vNodes. | |||||
// | |||||
// Thus the implicit locking order requirement is: (1) cs_main, (2) | |||||
// g_cs_orphans, (3) cs_vNodes. | |||||
void Stop() NO_THREAD_SAFETY_ANALYSIS; | |||||
void Interrupt(); | void Interrupt(); | ||||
bool GetNetworkActive() const { return fNetworkActive; }; | bool GetNetworkActive() const { return fNetworkActive; }; | ||||
void SetNetworkActive(bool active); | void SetNetworkActive(bool active); | ||||
void OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure, | void OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure, | ||||
CSemaphoreGrant *grantOutbound = nullptr, | CSemaphoreGrant *grantOutbound = nullptr, | ||||
const char *strDest = nullptr, | const char *strDest = nullptr, | ||||
bool fOneShot = false, bool fFeeler = false, | bool fOneShot = false, bool fFeeler = false, | ||||
bool manual_connection = false); | bool manual_connection = false); | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | private: | ||||
std::vector<ListenSocket> vhListenSocket; | std::vector<ListenSocket> vhListenSocket; | ||||
std::atomic<bool> fNetworkActive{true}; | std::atomic<bool> fNetworkActive{true}; | ||||
bool fAddressesInitialized{false}; | bool fAddressesInitialized{false}; | ||||
CAddrMan addrman; | CAddrMan addrman; | ||||
std::deque<std::string> vOneShots GUARDED_BY(cs_vOneShots); | std::deque<std::string> vOneShots GUARDED_BY(cs_vOneShots); | ||||
CCriticalSection cs_vOneShots; | CCriticalSection cs_vOneShots; | ||||
std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes); | std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes); | ||||
CCriticalSection cs_vAddedNodes; | CCriticalSection cs_vAddedNodes; | ||||
std::vector<CNode *> vNodes; | std::vector<CNode *> vNodes GUARDED_BY(cs_vNodes); | ||||
std::list<CNode *> vNodesDisconnected; | std::list<CNode *> vNodesDisconnected; | ||||
mutable CCriticalSection cs_vNodes; | mutable CCriticalSection cs_vNodes; | ||||
std::atomic<NodeId> nLastNodeId{0}; | std::atomic<NodeId> nLastNodeId{0}; | ||||
unsigned int nPrevNodeCount{0}; | unsigned int nPrevNodeCount{0}; | ||||
/** Services this instance offers */ | /** Services this instance offers */ | ||||
ServiceFlags nLocalServices; | ServiceFlags nLocalServices; | ||||
▲ Show 20 Lines • Show All 463 Lines • Show Last 20 Lines |