Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; | static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; | ||||
// | // | ||||
// Global state variables | // Global state variables | ||||
// | // | ||||
bool fDiscover = true; | bool fDiscover = true; | ||||
bool fListen = true; | bool fListen = true; | ||||
bool fRelayTxes = true; | bool fRelayTxes = true; | ||||
CCriticalSection cs_mapLocalHost; | CCriticalSection cs_mapLocalHost; | ||||
std::map<CNetAddr, LocalServiceInfo> mapLocalHost; | std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost); | ||||
static bool vfLimited[NET_MAX] = {}; | static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {}; | ||||
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ); | limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ); | ||||
void CConnman::AddOneShot(const std::string &strDest) { | void CConnman::AddOneShot(const std::string &strDest) { | ||||
LOCK(cs_vOneShots); | LOCK(cs_vOneShots); | ||||
vOneShots.push_back(strDest); | vOneShots.push_back(strDest); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | stats.nStartingHeight = nStartingHeight; | ||||
stats.nSendBytes = nSendBytes; | stats.nSendBytes = nSendBytes; | ||||
} | } | ||||
{ | { | ||||
LOCK(cs_vRecv); | LOCK(cs_vRecv); | ||||
stats.mapRecvBytesPerMsgCmd = mapRecvBytesPerMsgCmd; | stats.mapRecvBytesPerMsgCmd = mapRecvBytesPerMsgCmd; | ||||
stats.nRecvBytes = nRecvBytes; | stats.nRecvBytes = nRecvBytes; | ||||
} | } | ||||
stats.fWhitelisted = fWhitelisted; | stats.fWhitelisted = fWhitelisted; | ||||
{ | |||||
LOCK(cs_feeFilter); | |||||
stats.minFeeFilter = minFeeFilter; | stats.minFeeFilter = minFeeFilter; | ||||
} | |||||
// It is common for nodes with good ping times to suddenly become lagged, | // It is common for nodes with good ping times to suddenly become lagged, | ||||
// due to a new block arriving or other large transfer. Merely reporting | // due to a new block arriving or other large transfer. Merely reporting | ||||
// pingtime might fool the caller into thinking the node was still | // pingtime might fool the caller into thinking the node was still | ||||
// responsive, since pingtime does not update until the ping is complete, | // responsive, since pingtime does not update until the ping is complete, | ||||
// which might take a while. So, if a ping is taking an unusually long time | // which might take a while. So, if a ping is taking an unusually long time | ||||
// in flight, the caller can immediately detect that this is happening. | // in flight, the caller can immediately detect that this is happening. | ||||
int64_t nPingUsecWait = 0; | int64_t nPingUsecWait = 0; | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | |||||
const uint256 &CNetMessage::GetMessageHash() const { | const uint256 &CNetMessage::GetMessageHash() const { | ||||
assert(complete()); | assert(complete()); | ||||
if (data_hash.IsNull()) { | if (data_hash.IsNull()) { | ||||
hasher.Finalize(data_hash.begin()); | hasher.Finalize(data_hash.begin()); | ||||
} | } | ||||
return data_hash; | return data_hash; | ||||
} | } | ||||
// requires LOCK(cs_vSend) | size_t CConnman::SocketSendData(CNode *pnode) const | ||||
size_t CConnman::SocketSendData(CNode *pnode) const { | EXCLUSIVE_LOCKS_REQUIRED(pnode->cs_vSend) { | ||||
AssertLockHeld(pnode->cs_vSend); | |||||
size_t nSentSize = 0; | size_t nSentSize = 0; | ||||
size_t nMsgCount = 0; | size_t nMsgCount = 0; | ||||
for (const auto &data : pnode->vSendMsg) { | for (const auto &data : pnode->vSendMsg) { | ||||
assert(data.size() > pnode->nSendOffset); | assert(data.size() > pnode->nSendOffset); | ||||
int nBytes = 0; | int nBytes = 0; | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 2,196 Lines • Show Last 20 Lines |