Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 980 Lines • ▼ Show 20 Lines | public: | ||||
CNode *AddRef() { | CNode *AddRef() { | ||||
nRefCount++; | nRefCount++; | ||||
return this; | return this; | ||||
} | } | ||||
void Release() { nRefCount--; } | void Release() { nRefCount--; } | ||||
void AddAddressKnown(const CAddress &_addr) { | void AddAddressKnown(const CAddress &_addr) { | ||||
assert(m_addr_known); | |||||
m_addr_known->insert(_addr.GetKey()); | m_addr_known->insert(_addr.GetKey()); | ||||
} | } | ||||
void PushAddress(const CAddress &_addr, FastRandomContext &insecure_rand) { | void PushAddress(const CAddress &_addr, FastRandomContext &insecure_rand) { | ||||
// Known checking here is only to save space from duplicates. | // Known checking here is only to save space from duplicates. | ||||
// SendMessages will filter it again for knowns that were added | // SendMessages will filter it again for knowns that were added | ||||
// after addresses were pushed. | // after addresses were pushed. | ||||
assert(m_addr_known); | |||||
if (_addr.IsValid() && !m_addr_known->contains(_addr.GetKey())) { | if (_addr.IsValid() && !m_addr_known->contains(_addr.GetKey())) { | ||||
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) { | if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) { | ||||
vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = | vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = | ||||
_addr; | _addr; | ||||
} else { | } else { | ||||
vAddrToSend.push_back(_addr); | vAddrToSend.push_back(_addr); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |