diff --git a/src/seeder/db.h b/src/seeder/db.h --- a/src/seeder/db.h +++ b/src/seeder/db.h @@ -61,7 +61,7 @@ READWRITE(reliability); } - friend class CAddrInfo; + friend class SeederAddrInfo; }; class CAddrReport { @@ -76,7 +76,7 @@ uint64_t services; }; -class CAddrInfo { +class SeederAddrInfo { private: CService ip; uint64_t services; @@ -96,7 +96,7 @@ std::string clientSubVersion; public: - CAddrInfo() + SeederAddrInfo() : services(0), lastTry(0), ourLastTry(0), ourLastSuccess(0), ignoreTill(0), clientVersion(0), blocks(0), total(0), success(0) {} @@ -282,7 +282,7 @@ // number of address id's int nId; // map address id to address info (b,c,d,e) - std::map idToInfo; + std::map idToInfo; // map ip to id (b,c,d,e) std::map ipToId; // sequence of tried nodes, in order we have tried connecting to them (c,d) @@ -330,7 +330,7 @@ } void ResetIgnores() { - for (std::map::iterator it = idToInfo.begin(); + for (std::map::iterator it = idToInfo.begin(); it != idToInfo.end(); it++) { (*it).second.ignoreTill = 0; } @@ -341,7 +341,7 @@ LOCK(cs); for (std::deque::const_iterator it = ourId.begin(); it != ourId.end(); it++) { - const CAddrInfo &info = idToInfo[*it]; + const SeederAddrInfo &info = idToInfo[*it]; if (info.success > 0) { ret.push_back(info.GetReport()); } @@ -353,7 +353,7 @@ // format: // nVersion (0 for now) // n (number of ips in (b,c,d)) - // CAddrInfo[n] + // SeederAddrInfo[n] // banned // acquires a shared lock (this does not suffice for read mode, but we // assume that only happens at startup, single-threaded) this way, dumping @@ -369,12 +369,12 @@ s << n; for (std::deque::const_iterator it = ourId.begin(); it != ourId.end(); it++) { - std::map::iterator ci = db->idToInfo.find(*it); + std::map::iterator ci = db->idToInfo.find(*it); s << (*ci).second; } for (std::set::const_iterator it = unkId.begin(); it != unkId.end(); it++) { - std::map::iterator ci = db->idToInfo.find(*it); + std::map::iterator ci = db->idToInfo.find(*it); s << (*ci).second; } s << banned; @@ -391,7 +391,7 @@ int n; s >> n; for (int i = 0; i < n; i++) { - CAddrInfo info; + SeederAddrInfo info; s >> info; if (!info.GetBanTime()) { int id = db->nId++; diff --git a/src/seeder/db.cpp b/src/seeder/db.cpp --- a/src/seeder/db.cpp +++ b/src/seeder/db.cpp @@ -6,7 +6,7 @@ #include -void CAddrInfo::Update(bool good) { +void SeederAddrInfo::Update(bool good) { int64_t now = time(nullptr); if (ourLastTry == 0) { ourLastTry = now - MIN_RETRY; @@ -92,7 +92,7 @@ } unkId.erase(id); banned.erase(addr); - CAddrInfo &info = idToInfo[id]; + SeederAddrInfo &info = idToInfo[id]; info.clientVersion = clientV; info.clientSubVersion = clientSV; info.blocks = blocks; @@ -112,7 +112,7 @@ return; } unkId.erase(id); - CAddrInfo &info = idToInfo[id]; + SeederAddrInfo &info = idToInfo[id]; info.Update(false); uint32_t now = time(nullptr); int ter = info.GetBanTime(); @@ -154,7 +154,7 @@ } } if (ipToId.count(ipp)) { - CAddrInfo &ai = idToInfo[ipToId[ipp]]; + SeederAddrInfo &ai = idToInfo[ipToId[ipp]]; if (addr.nTime > ai.lastTry || ai.services != addr.nServices) { ai.lastTry = addr.nTime; ai.services |= addr.nServices; @@ -167,7 +167,7 @@ return; } - CAddrInfo ai; + SeederAddrInfo ai; ai.ip = ipp; ai.services = addr.nServices; ai.lastTry = addr.nTime;