Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | struct Options { | ||||
std::vector<std::string> m_added_nodes; | std::vector<std::string> m_added_nodes; | ||||
}; | }; | ||||
void Init(const Options &connOptions) { | void Init(const Options &connOptions) { | ||||
nLocalServices = connOptions.nLocalServices; | nLocalServices = connOptions.nLocalServices; | ||||
nMaxConnections = connOptions.nMaxConnections; | nMaxConnections = connOptions.nMaxConnections; | ||||
nMaxOutbound = | nMaxOutbound = | ||||
std::min(connOptions.nMaxOutbound, connOptions.nMaxConnections); | std::min(connOptions.nMaxOutbound, connOptions.nMaxConnections); | ||||
m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing; | |||||
nMaxAddnode = connOptions.nMaxAddnode; | nMaxAddnode = connOptions.nMaxAddnode; | ||||
nMaxFeeler = connOptions.nMaxFeeler; | nMaxFeeler = connOptions.nMaxFeeler; | ||||
nBestHeight = connOptions.nBestHeight; | nBestHeight = connOptions.nBestHeight; | ||||
clientInterface = connOptions.uiInterface; | clientInterface = connOptions.uiInterface; | ||||
m_banman = connOptions.m_banman; | m_banman = connOptions.m_banman; | ||||
m_msgproc = connOptions.m_msgproc; | m_msgproc = connOptions.m_msgproc; | ||||
nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | ||||
nReceiveFloodSize = connOptions.nReceiveFloodSize; | nReceiveFloodSize = connOptions.nReceiveFloodSize; | ||||
Show All 26 Lines | public: | ||||
// ForEachNode which locks cs_vNodes. | // ForEachNode which locks cs_vNodes. | ||||
// | // | ||||
// Thus the implicit locking order requirement is: (1) cs_main, (2) | // Thus the implicit locking order requirement is: (1) cs_main, (2) | ||||
// g_cs_orphans, (3) cs_vNodes. | // g_cs_orphans, (3) cs_vNodes. | ||||
void Stop() NO_THREAD_SAFETY_ANALYSIS; | void Stop() NO_THREAD_SAFETY_ANALYSIS; | ||||
void Interrupt(); | void Interrupt(); | ||||
bool GetNetworkActive() const { return fNetworkActive; }; | bool GetNetworkActive() const { return fNetworkActive; }; | ||||
bool GetUseAddrmanOutgoing() const { return m_use_addrman_outgoing; }; | |||||
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); | ||||
bool CheckIncomingNonce(uint64_t nonce); | bool CheckIncomingNonce(uint64_t nonce); | ||||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | private: | ||||
ServiceFlags nLocalServices; | ServiceFlags nLocalServices; | ||||
std::unique_ptr<CSemaphore> semOutbound; | std::unique_ptr<CSemaphore> semOutbound; | ||||
std::unique_ptr<CSemaphore> semAddnode; | std::unique_ptr<CSemaphore> semAddnode; | ||||
int nMaxConnections; | int nMaxConnections; | ||||
int nMaxOutbound; | int nMaxOutbound; | ||||
int nMaxAddnode; | int nMaxAddnode; | ||||
int nMaxFeeler; | int nMaxFeeler; | ||||
bool m_use_addrman_outgoing; | |||||
std::atomic<int> nBestHeight; | std::atomic<int> nBestHeight; | ||||
CClientUIInterface *clientInterface; | CClientUIInterface *clientInterface; | ||||
NetEventsInterface *m_msgproc; | NetEventsInterface *m_msgproc; | ||||
BanMan *m_banman; | BanMan *m_banman; | ||||
/** SipHasher seeds for deterministic randomness */ | /** SipHasher seeds for deterministic randomness */ | ||||
const uint64_t nSeed0, nSeed1; | const uint64_t nSeed0, nSeed1; | ||||
▲ Show 20 Lines • Show All 464 Lines • Show Last 20 Lines |