Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.h
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public: | ||||
bool fGood; | bool fGood; | ||||
uint64_t services; | uint64_t services; | ||||
}; | }; | ||||
class CAddrInfo { | class CAddrInfo { | ||||
private: | private: | ||||
CService ip; | CService ip; | ||||
uint64_t services; | uint64_t services; | ||||
int64_t timeFirstFound; | |||||
int64_t lastTry; | int64_t lastTry; | ||||
int64_t ourLastTry; | int64_t ourLastTry; | ||||
int64_t ourLastSuccess; | int64_t ourLastSuccess; | ||||
int64_t ignoreTill; | int64_t ignoreTill; | ||||
CAddrStat stat2H; | CAddrStat stat2H; | ||||
CAddrStat stat8H; | CAddrStat stat8H; | ||||
CAddrStat stat1D; | CAddrStat stat1D; | ||||
CAddrStat stat1W; | CAddrStat stat1W; | ||||
CAddrStat stat1M; | CAddrStat stat1M; | ||||
int clientVersion; | int clientVersion; | ||||
int blocks; | int blocks; | ||||
int total; | int total; | ||||
int success; | int success; | ||||
std::string clientSubVersion; | std::string clientSubVersion; | ||||
protected: | |||||
bool hasBeenTriedBefore() const { return total > 0; } | |||||
int64_t timeSinceFoundOrLastSuccess() { | |||||
int64_t now = time(nullptr); | |||||
int64_t lastSuccessOrFirstFoundTime = | |||||
success > 0 ? ourLastSuccess : timeFirstFound; | |||||
return now - lastSuccessOrFirstFoundTime; | |||||
} | |||||
public: | public: | ||||
CAddrInfo() | CAddrInfo() | ||||
: services(0), lastTry(0), ourLastTry(0), ourLastSuccess(0), | : services(0), timeFirstFound(time(nullptr)), lastTry(0), ourLastTry(0), | ||||
ignoreTill(0), clientVersion(0), blocks(0), total(0), success(0) {} | ourLastSuccess(0), ignoreTill(0), clientVersion(0), blocks(0), | ||||
total(0), success(0) {} | |||||
CAddrReport GetReport() const { | CAddrReport GetReport() const { | ||||
CAddrReport ret; | CAddrReport ret; | ||||
ret.ip = ip; | ret.ip = ip; | ||||
ret.clientVersion = clientVersion; | ret.clientVersion = clientVersion; | ||||
ret.clientSubVersion = clientSubVersion; | ret.clientSubVersion = clientSubVersion; | ||||
ret.blocks = blocks; | ret.blocks = blocks; | ||||
ret.uptime[0] = stat2H.reliability; | ret.uptime[0] = stat2H.reliability; | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
READWRITE(services); | READWRITE(services); | ||||
READWRITE(lastTry); | READWRITE(lastTry); | ||||
uint8_t tried = ourLastTry != 0; | uint8_t tried = ourLastTry != 0; | ||||
READWRITE(tried); | READWRITE(tried); | ||||
if (!tried) { | if (!tried) { | ||||
return; | return; | ||||
} | } | ||||
READWRITE(timeFirstFound); | |||||
READWRITE(ourLastTry); | READWRITE(ourLastTry); | ||||
READWRITE(ignoreTill); | READWRITE(ignoreTill); | ||||
READWRITE(stat2H); | READWRITE(stat2H); | ||||
READWRITE(stat8H); | READWRITE(stat8H); | ||||
READWRITE(stat1D); | READWRITE(stat1D); | ||||
READWRITE(stat1W); | READWRITE(stat1W); | ||||
if (version >= 1) { | if (version >= 1) { | ||||
READWRITE(stat1M); | READWRITE(stat1M); | ||||
Show All 23 Lines | public: | ||||
int nNew; | int nNew; | ||||
int nGood; | int nGood; | ||||
int nAge; | int nAge; | ||||
}; | }; | ||||
struct CServiceResult { | struct CServiceResult { | ||||
CService service; | CService service; | ||||
bool fGood; | bool fGood; | ||||
bool fReliable; | |||||
bool hasBeenTriedBefore; | |||||
int nBanTime; | int nBanTime; | ||||
int nHeight; | int nHeight; | ||||
int nClientV; | int nClientV; | ||||
std::string strClientV; | std::string strClientV; | ||||
int64_t ourLastSuccess; | int64_t ourLastSuccess; | ||||
int64_t timeSinceFoundOrLastSuccess; | |||||
}; | }; | ||||
/** | /** | ||||
* seen nodes | * seen nodes | ||||
* / \ | * / \ | ||||
* (a) banned nodes available nodes-------------- | * (a) banned nodes available nodes-------------- | ||||
* / | \ | * / | \ | ||||
* tracked nodes (b) unknown nodes (e) active nodes | * tracked nodes (b) unknown nodes (e) active nodes | ||||
▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines |