Remember the last successful poll time for each node
This commit is contained in:
parent
d7f5c245a3
commit
c4930f3312
2 changed files with 10 additions and 3 deletions
6
db.cpp
6
db.cpp
|
@ -11,7 +11,11 @@ void CAddrInfo::Update(bool good) {
|
||||||
lastTry = now;
|
lastTry = now;
|
||||||
ourLastTry = now;
|
ourLastTry = now;
|
||||||
total++;
|
total++;
|
||||||
if (good) success++;
|
if (good)
|
||||||
|
{
|
||||||
|
success++;
|
||||||
|
ourLastSuccess = now;
|
||||||
|
}
|
||||||
stat2H.Update(good, age, 3600*2);
|
stat2H.Update(good, age, 3600*2);
|
||||||
stat8H.Update(good, age, 3600*8);
|
stat8H.Update(good, age, 3600*8);
|
||||||
stat1D.Update(good, age, 3600*24);
|
stat1D.Update(good, age, 3600*24);
|
||||||
|
|
7
db.h
7
db.h
|
@ -61,6 +61,7 @@ private:
|
||||||
uint64_t services;
|
uint64_t services;
|
||||||
int64 lastTry;
|
int64 lastTry;
|
||||||
int64 ourLastTry;
|
int64 ourLastTry;
|
||||||
|
int64 ourLastSuccess;
|
||||||
int64 ignoreTill;
|
int64 ignoreTill;
|
||||||
CAddrStat stat2H;
|
CAddrStat stat2H;
|
||||||
CAddrStat stat8H;
|
CAddrStat stat8H;
|
||||||
|
@ -73,7 +74,7 @@ private:
|
||||||
int success;
|
int success;
|
||||||
std::string clientSubVersion;
|
std::string clientSubVersion;
|
||||||
public:
|
public:
|
||||||
CAddrInfo() : services(0), lastTry(0), ourLastTry(0), ignoreTill(0), clientVersion(0), blocks(0), total(0), success(0) {}
|
CAddrInfo() : services(0), lastTry(0), ourLastTry(0), ourLastSuccess(0), ignoreTill(0), clientVersion(0), blocks(0), total(0), success(0) {}
|
||||||
|
|
||||||
CAddrReport GetReport() const {
|
CAddrReport GetReport() const {
|
||||||
CAddrReport ret;
|
CAddrReport ret;
|
||||||
|
@ -126,7 +127,7 @@ public:
|
||||||
friend class CAddrDb;
|
friend class CAddrDb;
|
||||||
|
|
||||||
IMPLEMENT_SERIALIZE (
|
IMPLEMENT_SERIALIZE (
|
||||||
unsigned char version = 3;
|
unsigned char version = 4;
|
||||||
READWRITE(version);
|
READWRITE(version);
|
||||||
READWRITE(ip);
|
READWRITE(ip);
|
||||||
READWRITE(services);
|
READWRITE(services);
|
||||||
|
@ -152,6 +153,8 @@ public:
|
||||||
READWRITE(clientSubVersion);
|
READWRITE(clientSubVersion);
|
||||||
if (version >= 3)
|
if (version >= 3)
|
||||||
READWRITE(blocks);
|
READWRITE(blocks);
|
||||||
|
if (version >= 4)
|
||||||
|
READWRITE(ourLastSuccess);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue