aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-06-08 12:58:21 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-06-08 13:01:53 +0200
commit67c91f8c4cf738376f8b92429151494032bf9f91 (patch)
tree006d2121a7572a53c1cc8ceb943886e3bdde88c3 /src/addrman.cpp
parent2156fa23b8ac95283a8b11432607aaffaabd2953 (diff)
parent6182d10503ae3af222a7e4575724dce7ef563fec (diff)
Merge #8065: Addrman offline attempts
6182d10 Do not increment nAttempts by more than one for every Good connection. (Gregory Maxwell) c769c4a Avoid counting failed connect attempts when probably offline. (Gregory Maxwell)
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r--src/addrman.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 6c54cfa4cd..00f6fe99e0 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
@@ -311,7 +314,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
return fNew;
}
-void CAddrMan::Attempt_(const CService& addr, int64_t nTime)
+void CAddrMan::Attempt_(const CService& addr, bool fCountFailure, int64_t nTime)
{
CAddrInfo* pinfo = Find(addr);
@@ -327,7 +330,10 @@ void CAddrMan::Attempt_(const CService& addr, int64_t nTime)
// update info
info.nLastTry = nTime;
- info.nAttempts++;
+ if (fCountFailure && info.nLastCountAttempt < nLastGood) {
+ info.nLastCountAttempt = nTime;
+ info.nAttempts++;
+ }
}
CAddrInfo CAddrMan::Select_(bool newOnly)