Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.h
// Copyright (c) 2017-2019 The Bitcoin developers | // Copyright (c) 2017-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_SEEDER_DB_H | #ifndef BITCOIN_SEEDER_DB_H | ||||
#define BITCOIN_SEEDER_DB_H | #define BITCOIN_SEEDER_DB_H | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <protocol.h> | #include <protocol.h> | ||||
#include <seeder/bitcoin.h> | #include <seeder/bitcoin.h> | ||||
#include <seeder/util.h> | #include <seeder/util.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <util/time.h> | |||||
#include <version.h> | #include <version.h> | ||||
#include <cmath> | #include <cmath> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <deque> | #include <deque> | ||||
#include <map> | #include <map> | ||||
#include <set> | #include <set> | ||||
#include <vector> | #include <vector> | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | public: | ||||
void GetStats(CAddrDbStats &stats) const { | 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(); | ||||
if (ourId.size() > 0) { | if (ourId.size() > 0) { | ||||
stats.nAge = time(nullptr) - idToInfo.at(ourId.at(0)).ourLastTry; | stats.nAge = GetTime() - idToInfo.at(ourId.at(0)).ourLastTry; | ||||
} else { | } else { | ||||
stats.nAge = 0; | stats.nAge = 0; | ||||
} | } | ||||
} | } | ||||
void ResetIgnores() { | void ResetIgnores() { | ||||
for (std::map<int, SeederAddrInfo>::iterator it = idToInfo.begin(); | for (std::map<int, SeederAddrInfo>::iterator it = idToInfo.begin(); | ||||
it != idToInfo.end(); it++) { | it != idToInfo.end(); it++) { | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |