aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2015-04-19 13:39:38 -0700
committerGregory Maxwell <greg@xiph.org>2016-05-26 12:56:32 +0000
commit6182d10503ae3af222a7e4575724dce7ef563fec (patch)
tree1d3eb65c41fee943ae7c2cfcc8873188a1ffaab7 /src/addrman.h
parentc769c4af11fc58dd4813d328c7f71042bc577676 (diff)
Do not increment nAttempts by more than one for every Good connection.
This slows the increase of the nAttempts in addrman while partitioned, even if the node hasn't yet noticed the partitioning.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 65ca79fa02..c5923e9417 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -29,6 +29,9 @@ public:
//! last try whatsoever by us (memory only)
int64_t nLastTry;
+ //! last counted attempt (memory only)
+ int64_t nLastCountAttempt;
+
private:
//! where knowledge about this address first came from
CNetAddr source;
@@ -66,6 +69,7 @@ public:
{
nLastSuccess = 0;
nLastTry = 0;
+ nLastCountAttempt = 0;
nAttempts = 0;
nRefCount = 0;
fInTried = false;
@@ -200,6 +204,9 @@ private:
//! list of "new" buckets
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE];
+ //! last time Good was called (memory only)
+ int64_t nLastGood;
+
protected:
//! secret key to randomize bucket select with
uint256 nKey;
@@ -458,6 +465,7 @@ public:
nIdCount = 0;
nTried = 0;
nNew = 0;
+ nLastGood = 1; //Initially at 1 so that "never" is strictly worse.
}
CAddrMan()