diff options
| author | Gregory Maxwell <[email protected]> | 2015-04-19 13:39:38 -0700 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2016-05-26 12:56:32 +0000 |
| commit | 6182d10503ae3af222a7e4575724dce7ef563fec (patch) | |
| tree | 1d3eb65c41fee943ae7c2cfcc8873188a1ffaab7 /src/addrman.cpp | |
| parent | Avoid counting failed connect attempts when probably offline. (diff) | |
| download | discoin-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.cpp')
| -rw-r--r-- | src/addrman.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index 0a1745c10..00f6fe99e 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -197,6 +197,9 @@ void CAddrMan::MakeTried(CAddrInfo& info, int nId) void CAddrMan::Good_(const CService& addr, int64_t nTime) { int nId; + + nLastGood = nTime; + CAddrInfo* pinfo = Find(addr, &nId); // if not found, bail out @@ -327,7 +330,10 @@ void CAddrMan::Attempt_(const CService& addr, bool fCountFailure, int64_t nTime) // update info info.nLastTry = nTime; - if (fCountFailure) info.nAttempts++; + if (fCountFailure && info.nLastCountAttempt < nLastGood) { + info.nLastCountAttempt = nTime; + info.nAttempts++; + } } CAddrInfo CAddrMan::Select_(bool newOnly) |