mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
scripted-diff: Rename addrman time symbols
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren nLastTry m_last_try ren nLastSuccess m_last_success ren nLastGood m_last_good ren nLastCountAttempt m_last_count_attempt ren nSinceLastTry since_last_try ren nTimePenalty time_penalty ren nUpdateInterval update_interval ren fCurrentlyOnline currently_online -END VERIFY SCRIPT-
This commit is contained in:
@ -66,7 +66,7 @@ int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) con
|
|||||||
|
|
||||||
bool AddrInfo::IsTerrible(int64_t nNow) const
|
bool AddrInfo::IsTerrible(int64_t nNow) const
|
||||||
{
|
{
|
||||||
if (nNow - nLastTry <= 60) { // never remove things tried in the last minute
|
if (nNow - m_last_try <= 60) { // never remove things tried in the last minute
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,10 +77,10 @@ bool AddrInfo::IsTerrible(int64_t nNow) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nLastSuccess == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
|
if (m_last_success == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (nNow - nLastSuccess > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
|
if (nNow - m_last_success > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -91,7 +91,7 @@ double AddrInfo::GetChance(int64_t nNow) const
|
|||||||
double fChance = 1.0;
|
double fChance = 1.0;
|
||||||
|
|
||||||
// deprioritize very recent attempts away
|
// deprioritize very recent attempts away
|
||||||
if (nNow - nLastTry < 60 * 10) {
|
if (nNow - m_last_try < 60 * 10) {
|
||||||
fChance *= 0.01;
|
fChance *= 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ void AddrManImpl::MakeTried(AddrInfo& info, int nId)
|
|||||||
info.fInTried = true;
|
info.fInTried = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty)
|
bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_t time_penalty)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs);
|
AssertLockHeld(cs);
|
||||||
|
|
||||||
@ -552,15 +552,15 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
|
|||||||
|
|
||||||
// Do not set a penalty for a source's self-announcement
|
// Do not set a penalty for a source's self-announcement
|
||||||
if (addr == source) {
|
if (addr == source) {
|
||||||
nTimePenalty = 0;
|
time_penalty = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pinfo) {
|
if (pinfo) {
|
||||||
// periodically update nTime
|
// periodically update nTime
|
||||||
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
|
bool currently_online = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
|
||||||
int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
|
int64_t update_interval = (currently_online ? 60 * 60 : 24 * 60 * 60);
|
||||||
if (pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty) {
|
if (pinfo->nTime < addr.nTime - update_interval - time_penalty) {
|
||||||
pinfo->nTime = std::max((int64_t)0, addr.nTime - nTimePenalty);
|
pinfo->nTime = std::max((int64_t)0, addr.nTime - time_penalty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add services
|
// add services
|
||||||
@ -587,7 +587,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
pinfo = Create(addr, source, &nId);
|
pinfo = Create(addr, source, &nId);
|
||||||
pinfo->nTime = std::max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
|
pinfo->nTime = std::max((int64_t)0, (int64_t)pinfo->nTime - time_penalty);
|
||||||
nNew++;
|
nNew++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
|
|||||||
|
|
||||||
int nId;
|
int nId;
|
||||||
|
|
||||||
nLastGood = nTime;
|
m_last_good = nTime;
|
||||||
|
|
||||||
AddrInfo* pinfo = Find(addr, &nId);
|
AddrInfo* pinfo = Find(addr, &nId);
|
||||||
|
|
||||||
@ -633,8 +633,8 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
|
|||||||
AddrInfo& info = *pinfo;
|
AddrInfo& info = *pinfo;
|
||||||
|
|
||||||
// update info
|
// update info
|
||||||
info.nLastSuccess = nTime;
|
info.m_last_success = nTime;
|
||||||
info.nLastTry = nTime;
|
info.m_last_try = nTime;
|
||||||
info.nAttempts = 0;
|
info.nAttempts = 0;
|
||||||
// nTime is not updated here, to avoid leaking information about
|
// nTime is not updated here, to avoid leaking information about
|
||||||
// currently-connected peers.
|
// currently-connected peers.
|
||||||
@ -671,11 +671,11 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddrManImpl::Add_(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty)
|
bool AddrManImpl::Add_(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t time_penalty)
|
||||||
{
|
{
|
||||||
int added{0};
|
int added{0};
|
||||||
for (std::vector<CAddress>::const_iterator it = vAddr.begin(); it != vAddr.end(); it++) {
|
for (std::vector<CAddress>::const_iterator it = vAddr.begin(); it != vAddr.end(); it++) {
|
||||||
added += AddSingle(*it, source, nTimePenalty) ? 1 : 0;
|
added += AddSingle(*it, source, time_penalty) ? 1 : 0;
|
||||||
}
|
}
|
||||||
if (added > 0) {
|
if (added > 0) {
|
||||||
LogPrint(BCLog::ADDRMAN, "Added %i addresses (of %i) from %s: %i tried, %i new\n", added, vAddr.size(), source.ToString(), nTried, nNew);
|
LogPrint(BCLog::ADDRMAN, "Added %i addresses (of %i) from %s: %i tried, %i new\n", added, vAddr.size(), source.ToString(), nTried, nNew);
|
||||||
@ -696,9 +696,9 @@ void AddrManImpl::Attempt_(const CService& addr, bool fCountFailure, int64_t nTi
|
|||||||
AddrInfo& info = *pinfo;
|
AddrInfo& info = *pinfo;
|
||||||
|
|
||||||
// update info
|
// update info
|
||||||
info.nLastTry = nTime;
|
info.m_last_try = nTime;
|
||||||
if (fCountFailure && info.nLastCountAttempt < nLastGood) {
|
if (fCountFailure && info.m_last_count_attempt < m_last_good) {
|
||||||
info.nLastCountAttempt = nTime;
|
info.m_last_count_attempt = nTime;
|
||||||
info.nAttempts++;
|
info.nAttempts++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -736,7 +736,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
|
|||||||
// With probability GetChance() * fChanceFactor, return the entry.
|
// With probability GetChance() * fChanceFactor, return the entry.
|
||||||
if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
|
if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
|
||||||
LogPrint(BCLog::ADDRMAN, "Selected %s from tried\n", info.ToString());
|
LogPrint(BCLog::ADDRMAN, "Selected %s from tried\n", info.ToString());
|
||||||
return {info, info.nLastTry};
|
return {info, info.m_last_try};
|
||||||
}
|
}
|
||||||
// Otherwise start over with a (likely) different bucket, and increased chance factor.
|
// Otherwise start over with a (likely) different bucket, and increased chance factor.
|
||||||
fChanceFactor *= 1.2;
|
fChanceFactor *= 1.2;
|
||||||
@ -764,7 +764,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
|
|||||||
// With probability GetChance() * fChanceFactor, return the entry.
|
// With probability GetChance() * fChanceFactor, return the entry.
|
||||||
if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
|
if (insecure_rand.randbits(30) < fChanceFactor * info.GetChance() * (1 << 30)) {
|
||||||
LogPrint(BCLog::ADDRMAN, "Selected %s from new\n", info.ToString());
|
LogPrint(BCLog::ADDRMAN, "Selected %s from new\n", info.ToString());
|
||||||
return {info, info.nLastTry};
|
return {info, info.m_last_try};
|
||||||
}
|
}
|
||||||
// Otherwise start over with a (likely) different bucket, and increased chance factor.
|
// Otherwise start over with a (likely) different bucket, and increased chance factor.
|
||||||
fChanceFactor *= 1.2;
|
fChanceFactor *= 1.2;
|
||||||
@ -823,8 +823,8 @@ void AddrManImpl::Connected_(const CService& addr, int64_t nTime)
|
|||||||
AddrInfo& info = *pinfo;
|
AddrInfo& info = *pinfo;
|
||||||
|
|
||||||
// update info
|
// update info
|
||||||
int64_t nUpdateInterval = 20 * 60;
|
int64_t update_interval = 20 * 60;
|
||||||
if (nTime - info.nTime > nUpdateInterval)
|
if (nTime - info.nTime > update_interval)
|
||||||
info.nTime = nTime;
|
info.nTime = nTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,19 +873,19 @@ void AddrManImpl::ResolveCollisions_()
|
|||||||
const auto current_time{GetAdjustedTime()};
|
const auto current_time{GetAdjustedTime()};
|
||||||
|
|
||||||
// Has successfully connected in last X hours
|
// Has successfully connected in last X hours
|
||||||
if (current_time - info_old.nLastSuccess < ADDRMAN_REPLACEMENT_HOURS*(60*60)) {
|
if (current_time - info_old.m_last_success < ADDRMAN_REPLACEMENT_HOURS*(60*60)) {
|
||||||
erase_collision = true;
|
erase_collision = true;
|
||||||
} else if (current_time - info_old.nLastTry < ADDRMAN_REPLACEMENT_HOURS*(60*60)) { // attempted to connect and failed in last X hours
|
} else if (current_time - info_old.m_last_try < ADDRMAN_REPLACEMENT_HOURS*(60*60)) { // attempted to connect and failed in last X hours
|
||||||
|
|
||||||
// Give address at least 60 seconds to successfully connect
|
// Give address at least 60 seconds to successfully connect
|
||||||
if (current_time - info_old.nLastTry > 60) {
|
if (current_time - info_old.m_last_try > 60) {
|
||||||
LogPrint(BCLog::ADDRMAN, "Replacing %s with %s in tried table\n", info_old.ToString(), info_new.ToString());
|
LogPrint(BCLog::ADDRMAN, "Replacing %s with %s in tried table\n", info_old.ToString(), info_new.ToString());
|
||||||
|
|
||||||
// Replaces an existing address already in the tried table with the new address
|
// Replaces an existing address already in the tried table with the new address
|
||||||
Good_(info_new, false, current_time);
|
Good_(info_new, false, current_time);
|
||||||
erase_collision = true;
|
erase_collision = true;
|
||||||
}
|
}
|
||||||
} else if (current_time - info_new.nLastSuccess > ADDRMAN_TEST_WINDOW) {
|
} else if (current_time - info_new.m_last_success > ADDRMAN_TEST_WINDOW) {
|
||||||
// If the collision hasn't resolved in some reasonable amount of time,
|
// If the collision hasn't resolved in some reasonable amount of time,
|
||||||
// just evict the old entry -- we must not be able to
|
// just evict the old entry -- we must not be able to
|
||||||
// connect to it for some reason.
|
// connect to it for some reason.
|
||||||
@ -932,7 +932,7 @@ std::pair<CAddress, int64_t> AddrManImpl::SelectTriedCollision_()
|
|||||||
int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket);
|
int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket);
|
||||||
|
|
||||||
const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]];
|
const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]];
|
||||||
return {info_old, info_old.nLastTry};
|
return {info_old, info_old.m_last_try};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr)
|
std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr)
|
||||||
@ -990,7 +990,7 @@ int AddrManImpl::CheckAddrman() const
|
|||||||
int n = entry.first;
|
int n = entry.first;
|
||||||
const AddrInfo& info = entry.second;
|
const AddrInfo& info = entry.second;
|
||||||
if (info.fInTried) {
|
if (info.fInTried) {
|
||||||
if (!info.nLastSuccess)
|
if (!info.m_last_success)
|
||||||
return -1;
|
return -1;
|
||||||
if (info.nRefCount)
|
if (info.nRefCount)
|
||||||
return -2;
|
return -2;
|
||||||
@ -1008,9 +1008,9 @@ int AddrManImpl::CheckAddrman() const
|
|||||||
}
|
}
|
||||||
if (info.nRandomPos < 0 || (size_t)info.nRandomPos >= vRandom.size() || vRandom[info.nRandomPos] != n)
|
if (info.nRandomPos < 0 || (size_t)info.nRandomPos >= vRandom.size() || vRandom[info.nRandomPos] != n)
|
||||||
return -14;
|
return -14;
|
||||||
if (info.nLastTry < 0)
|
if (info.m_last_try < 0)
|
||||||
return -6;
|
return -6;
|
||||||
if (info.nLastSuccess < 0)
|
if (info.m_last_success < 0)
|
||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,11 +1067,11 @@ size_t AddrManImpl::size() const
|
|||||||
return vRandom.size();
|
return vRandom.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddrManImpl::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
|
bool AddrManImpl::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty)
|
||||||
{
|
{
|
||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
Check();
|
Check();
|
||||||
auto ret = Add_(vAddr, source, nTimePenalty);
|
auto ret = Add_(vAddr, source, time_penalty);
|
||||||
Check();
|
Check();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1184,9 +1184,9 @@ size_t AddrMan::size() const
|
|||||||
return m_impl->size();
|
return m_impl->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddrMan::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
|
bool AddrMan::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty)
|
||||||
{
|
{
|
||||||
return m_impl->Add(vAddr, source, nTimePenalty);
|
return m_impl->Add(vAddr, source, time_penalty);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddrMan::Good(const CService& addr, int64_t nTime)
|
bool AddrMan::Good(const CService& addr, int64_t nTime)
|
||||||
|
@ -107,11 +107,11 @@ public:
|
|||||||
*
|
*
|
||||||
* @param[in] vAddr Address records to attempt to add.
|
* @param[in] vAddr Address records to attempt to add.
|
||||||
* @param[in] source The address of the node that sent us these addr records.
|
* @param[in] source The address of the node that sent us these addr records.
|
||||||
* @param[in] nTimePenalty A "time penalty" to apply to the address record's nTime. If a peer
|
* @param[in] time_penalty A "time penalty" to apply to the address record's nTime. If a peer
|
||||||
* sends us an address record with nTime=n, then we'll add it to our
|
* sends us an address record with nTime=n, then we'll add it to our
|
||||||
* addrman with nTime=(n - nTimePenalty).
|
* addrman with nTime=(n - time_penalty).
|
||||||
* @return true if at least one address is successfully added. */
|
* @return true if at least one address is successfully added. */
|
||||||
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty = 0);
|
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark an address record as accessible and attempt to move it to addrman's tried table.
|
* Mark an address record as accessible and attempt to move it to addrman's tried table.
|
||||||
|
@ -38,16 +38,16 @@ class AddrInfo : public CAddress
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! last try whatsoever by us (memory only)
|
//! last try whatsoever by us (memory only)
|
||||||
int64_t nLastTry{0};
|
int64_t m_last_try{0};
|
||||||
|
|
||||||
//! last counted attempt (memory only)
|
//! last counted attempt (memory only)
|
||||||
int64_t nLastCountAttempt{0};
|
int64_t m_last_count_attempt{0};
|
||||||
|
|
||||||
//! where knowledge about this address first came from
|
//! where knowledge about this address first came from
|
||||||
CNetAddr source;
|
CNetAddr source;
|
||||||
|
|
||||||
//! last successful connection by us
|
//! last successful connection by us
|
||||||
int64_t nLastSuccess{0};
|
int64_t m_last_success{0};
|
||||||
|
|
||||||
//! connection attempts since last successful attempt
|
//! connection attempts since last successful attempt
|
||||||
int nAttempts{0};
|
int nAttempts{0};
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
SERIALIZE_METHODS(AddrInfo, obj)
|
SERIALIZE_METHODS(AddrInfo, obj)
|
||||||
{
|
{
|
||||||
READWRITEAS(CAddress, obj);
|
READWRITEAS(CAddress, obj);
|
||||||
READWRITE(obj.source, obj.nLastSuccess, obj.nAttempts);
|
READWRITE(obj.source, obj.m_last_success, obj.nAttempts);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddrInfo(const CAddress &addrIn, const CNetAddr &addrSource) : CAddress(addrIn), source(addrSource)
|
AddrInfo(const CAddress &addrIn, const CNetAddr &addrSource) : CAddress(addrIn), source(addrSource)
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
size_t size() const EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
size_t size() const EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||||
|
|
||||||
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty)
|
bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||||
|
|
||||||
bool Good(const CService& addr, int64_t nTime)
|
bool Good(const CService& addr, int64_t nTime)
|
||||||
@ -202,7 +202,7 @@ private:
|
|||||||
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||||
|
|
||||||
//! last time Good was called (memory only). Initially set to 1 so that "never" is strictly worse.
|
//! last time Good was called (memory only). Initially set to 1 so that "never" is strictly worse.
|
||||||
int64_t nLastGood GUARDED_BY(cs){1};
|
int64_t m_last_good GUARDED_BY(cs){1};
|
||||||
|
|
||||||
//! Holds addrs inserted into tried table that collide with existing entries. Test-before-evict discipline used to resolve these collisions.
|
//! Holds addrs inserted into tried table that collide with existing entries. Test-before-evict discipline used to resolve these collisions.
|
||||||
std::set<int> m_tried_collisions;
|
std::set<int> m_tried_collisions;
|
||||||
@ -233,11 +233,11 @@ private:
|
|||||||
|
|
||||||
/** Attempt to add a single address to addrman's new table.
|
/** Attempt to add a single address to addrman's new table.
|
||||||
* @see AddrMan::Add() for parameters. */
|
* @see AddrMan::Add() for parameters. */
|
||||||
bool AddSingle(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
bool AddSingle(const CAddress& addr, const CNetAddr& source, int64_t time_penalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
bool Good_(const CService& addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
bool Good_(const CService& addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
bool Add_(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
bool Add_(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t time_penalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
void Attempt_(const CService& addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
void Attempt_(const CService& addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public:
|
|||||||
CSipHasher hasher(0, 0);
|
CSipHasher hasher(0, 0);
|
||||||
auto addr_key = a.GetKey();
|
auto addr_key = a.GetKey();
|
||||||
auto source_key = a.source.GetAddrBytes();
|
auto source_key = a.source.GetAddrBytes();
|
||||||
hasher.Write(a.nLastSuccess);
|
hasher.Write(a.m_last_success);
|
||||||
hasher.Write(a.nAttempts);
|
hasher.Write(a.nAttempts);
|
||||||
hasher.Write(a.nRefCount);
|
hasher.Write(a.nRefCount);
|
||||||
hasher.Write(a.fInTried);
|
hasher.Write(a.fInTried);
|
||||||
@ -175,8 +175,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto addrinfo_eq = [](const AddrInfo& lhs, const AddrInfo& rhs) {
|
auto addrinfo_eq = [](const AddrInfo& lhs, const AddrInfo& rhs) {
|
||||||
return std::tie(static_cast<const CService&>(lhs), lhs.source, lhs.nLastSuccess, lhs.nAttempts, lhs.nRefCount, lhs.fInTried) ==
|
return std::tie(static_cast<const CService&>(lhs), lhs.source, lhs.m_last_success, lhs.nAttempts, lhs.nRefCount, lhs.fInTried) ==
|
||||||
std::tie(static_cast<const CService&>(rhs), rhs.source, rhs.nLastSuccess, rhs.nAttempts, rhs.nRefCount, rhs.fInTried);
|
std::tie(static_cast<const CService&>(rhs), rhs.source, rhs.m_last_success, rhs.nAttempts, rhs.nRefCount, rhs.fInTried);
|
||||||
};
|
};
|
||||||
|
|
||||||
using Addresses = std::unordered_set<AddrInfo, decltype(addrinfo_hasher), decltype(addrinfo_eq)>;
|
using Addresses = std::unordered_set<AddrInfo, decltype(addrinfo_hasher), decltype(addrinfo_eq)>;
|
||||||
|
Reference in New Issue
Block a user