aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorGregory Maxwell <[email protected]>2015-04-19 13:39:38 -0700
committerGregory Maxwell <[email protected]>2016-05-26 12:56:32 +0000
commit6182d10503ae3af222a7e4575724dce7ef563fec (patch)
tree1d3eb65c41fee943ae7c2cfcc8873188a1ffaab7 /src/addrman.h
parentAvoid counting failed connect attempts when probably offline. (diff)
downloaddiscoin-6182d10503ae3af222a7e4575724dce7ef563fec.tar.xz
discoin-6182d10503ae3af222a7e4575724dce7ef563fec.zip
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 65ca79fa0..c5923e941 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()