Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | void Init(const Options &connOptions) { | ||||
std::min(connOptions.nMaxOutbound, connOptions.nMaxConnections); | std::min(connOptions.nMaxOutbound, connOptions.nMaxConnections); | ||||
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_msgproc = connOptions.m_msgproc; | m_msgproc = connOptions.m_msgproc; | ||||
nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | ||||
nReceiveFloodSize = connOptions.nReceiveFloodSize; | nReceiveFloodSize = connOptions.nReceiveFloodSize; | ||||
{ | |||||
LOCK(cs_totalBytesSent); | |||||
nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe; | nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe; | ||||
nMaxOutboundLimit = connOptions.nMaxOutboundLimit; | nMaxOutboundLimit = connOptions.nMaxOutboundLimit; | ||||
} | |||||
vWhitelistedRange = connOptions.vWhitelistedRange; | vWhitelistedRange = connOptions.vWhitelistedRange; | ||||
{ | |||||
LOCK(cs_vAddedNodes); | |||||
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(); | void Stop(); | ||||
void Interrupt(); | void Interrupt(); | ||||
bool GetNetworkActive() const { return fNetworkActive; }; | bool GetNetworkActive() const { return fNetworkActive; }; | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | private: | ||||
// Whether the node should be passed out in ForEach* callbacks | // Whether the node should be passed out in ForEach* callbacks | ||||
static bool NodeFullyConnected(const CNode *pnode); | static bool NodeFullyConnected(const CNode *pnode); | ||||
const Config *config; | const Config *config; | ||||
// Network usage totals | // Network usage totals | ||||
CCriticalSection cs_totalBytesRecv; | CCriticalSection cs_totalBytesRecv; | ||||
CCriticalSection cs_totalBytesSent; | CCriticalSection cs_totalBytesSent; | ||||
uint64_t nTotalBytesRecv; | uint64_t nTotalBytesRecv GUARDED_BY(cs_totalBytesRecv); | ||||
uint64_t nTotalBytesSent; | uint64_t nTotalBytesSent GUARDED_BY(cs_totalBytesSent); | ||||
// outbound limit & stats | // outbound limit & stats | ||||
uint64_t nMaxOutboundTotalBytesSentInCycle; | uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY(cs_totalBytesSent); | ||||
uint64_t nMaxOutboundCycleStartTime; | uint64_t nMaxOutboundCycleStartTime GUARDED_BY(cs_totalBytesSent); | ||||
uint64_t nMaxOutboundLimit; | uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent); | ||||
uint64_t nMaxOutboundTimeframe; | uint64_t nMaxOutboundTimeframe GUARDED_BY(cs_totalBytesSent); | ||||
// Whitelisted ranges. Any node connecting from these is automatically | // Whitelisted ranges. Any node connecting from these is automatically | ||||
// whitelisted (as well as those connecting to whitelisted binds). | // whitelisted (as well as those connecting to whitelisted binds). | ||||
std::vector<CSubNet> vWhitelistedRange; | std::vector<CSubNet> vWhitelistedRange; | ||||
unsigned int nSendBufferMaxSize; | unsigned int nSendBufferMaxSize; | ||||
unsigned int nReceiveFloodSize; | unsigned int nReceiveFloodSize; | ||||
std::vector<ListenSocket> vhListenSocket; | std::vector<ListenSocket> vhListenSocket; | ||||
std::atomic<bool> fNetworkActive; | std::atomic<bool> fNetworkActive; | ||||
banmap_t setBanned; | banmap_t setBanned; | ||||
CCriticalSection cs_setBanned; | CCriticalSection cs_setBanned; | ||||
bool setBannedIsDirty; | bool setBannedIsDirty; | ||||
bool fAddressesInitialized; | bool fAddressesInitialized; | ||||
CAddrMan addrman; | CAddrMan addrman; | ||||
std::deque<std::string> vOneShots; | std::deque<std::string> vOneShots; | ||||
CCriticalSection cs_vOneShots; | CCriticalSection cs_vOneShots; | ||||
std::vector<std::string> vAddedNodes; | std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes); | ||||
CCriticalSection cs_vAddedNodes; | CCriticalSection cs_vAddedNodes; | ||||
std::vector<CNode *> vNodes; | std::vector<CNode *> vNodes; | ||||
std::list<CNode *> vNodesDisconnected; | std::list<CNode *> vNodesDisconnected; | ||||
mutable CCriticalSection cs_vNodes; | mutable CCriticalSection cs_vNodes; | ||||
std::atomic<NodeId> nLastNodeId; | std::atomic<NodeId> nLastNodeId; | ||||
/** Services this instance offers */ | /** Services this instance offers */ | ||||
ServiceFlags nLocalServices; | ServiceFlags nLocalServices; | ||||
▲ Show 20 Lines • Show All 457 Lines • Show Last 20 Lines |