Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 834 Lines • ▼ Show 20 Lines | protected: | ||||
mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); | mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); | ||||
public: | public: | ||||
BlockHash hashContinue; | BlockHash hashContinue; | ||||
std::atomic<int> nStartingHeight{-1}; | std::atomic<int> nStartingHeight{-1}; | ||||
// flood relay | // flood relay | ||||
std::vector<CAddress> vAddrToSend; | std::vector<CAddress> vAddrToSend; | ||||
CRollingBloomFilter addrKnown; | std::unique_ptr<CRollingBloomFilter> m_addr_known; | ||||
bool fGetAddr{false}; | bool fGetAddr{false}; | ||||
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0}; | int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0}; | ||||
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0}; | int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0}; | ||||
const bool m_addr_relay_peer; | const bool m_addr_relay_peer; | ||||
bool IsAddrRelayPeer() const { return m_addr_relay_peer; } | bool IsAddrRelayPeer() const { return m_addr_relay_peer; } | ||||
// List of block ids we still have to announce. | // List of block ids we still have to announce. | ||||
▲ Show 20 Lines • Show All 129 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) { | ||||
addrKnown.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. | ||||
if (_addr.IsValid() && !addrKnown.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 47 Lines • Show Last 20 Lines |