Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.h
Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | protected: | ||||
// get a random set of IPs (shared lock only) | // get a random set of IPs (shared lock only) | ||||
void GetIPs_(std::set<CNetAddr> &ips, uint64_t requestedFlags, uint32_t max, | void GetIPs_(std::set<CNetAddr> &ips, uint64_t requestedFlags, uint32_t max, | ||||
const bool *nets); | const bool *nets); | ||||
public: | public: | ||||
// nodes that are banned, with their unban time (a) | // nodes that are banned, with their unban time (a) | ||||
std::map<CService, int64_t> banned; | std::map<CService, int64_t> banned; | ||||
void GetStats(CAddrDbStats &stats) { | void GetStats(CAddrDbStats &stats) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
stats.nBanned = banned.size(); | stats.nBanned = banned.size(); | ||||
stats.nAvail = idToInfo.size(); | stats.nAvail = idToInfo.size(); | ||||
stats.nTracked = ourId.size(); | stats.nTracked = ourId.size(); | ||||
stats.nGood = goodId.size(); | stats.nGood = goodId.size(); | ||||
stats.nNew = unkId.size(); | stats.nNew = unkId.size(); | ||||
stats.nAge = time(nullptr) - idToInfo[ourId[0]].ourLastTry; | if (ourId.size() > 0) { | ||||
stats.nAge = time(nullptr) - idToInfo.at(ourId.at(0)).ourLastTry; | |||||
} else { | |||||
stats.nAge = 0; | |||||
} | |||||
} | } | ||||
void ResetIgnores() { | void ResetIgnores() { | ||||
for (std::map<int, CAddrInfo>::iterator it = idToInfo.begin(); | for (std::map<int, CAddrInfo>::iterator it = idToInfo.begin(); | ||||
it != idToInfo.end(); it++) { | it != idToInfo.end(); it++) { | ||||
(*it).second.ignoreTill = 0; | (*it).second.ignoreTill = 0; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |