Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.h
| Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | public: | ||||
| } | } | ||||
| void Update(bool good); | void Update(bool good); | ||||
| friend class CAddrDb; | friend class CAddrDb; | ||||
| SERIALIZE_METHODS(SeederAddrInfo, obj) { | SERIALIZE_METHODS(SeederAddrInfo, obj) { | ||||
| uint8_t version = 5; | uint8_t version = 5; | ||||
| READWRITE(version, obj.ip, obj.services, obj.lastTry); | READWRITE(version, WithParams(CAddress::V1_DISK, obj.ip), obj.services, | ||||
| obj.lastTry); | |||||
| uint8_t tried = obj.ourLastTry != 0; | uint8_t tried = obj.ourLastTry != 0; | ||||
| READWRITE(tried); | READWRITE(tried); | ||||
| if (!tried) { | if (!tried) { | ||||
| return; | return; | ||||
| } | } | ||||
| READWRITE(obj.ourLastTry, obj.ignoreTill, obj.stat2H, obj.stat8H, | READWRITE(obj.ourLastTry, obj.ignoreTill, obj.stat2H, obj.stat8H, | ||||
| obj.stat1D, obj.stat1W); | obj.stat1D, obj.stat1W); | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | template <typename Stream> void Serialize(Stream &s) const { | ||||
| std::map<int, SeederAddrInfo>::iterator ci = db->idToInfo.find(*it); | std::map<int, SeederAddrInfo>::iterator ci = db->idToInfo.find(*it); | ||||
| s << (*ci).second; | s << (*ci).second; | ||||
| } | } | ||||
| for (std::set<int>::const_iterator it = unkId.begin(); | for (std::set<int>::const_iterator it = unkId.begin(); | ||||
| it != unkId.end(); it++) { | it != unkId.end(); it++) { | ||||
| std::map<int, SeederAddrInfo>::iterator ci = db->idToInfo.find(*it); | std::map<int, SeederAddrInfo>::iterator ci = db->idToInfo.find(*it); | ||||
| s << (*ci).second; | s << (*ci).second; | ||||
| } | } | ||||
| s << banned; | s << WithParams(CAddress::V1_DISK, banned); | ||||
| } | } | ||||
| template <typename Stream> void Unserialize(Stream &s) { | template <typename Stream> void Unserialize(Stream &s) { | ||||
| LOCK(cs); | LOCK(cs); | ||||
| int nVersion; | int nVersion; | ||||
| s >> nVersion; | s >> nVersion; | ||||
| Show All 14 Lines | template <typename Stream> void Unserialize(Stream &s) { | ||||
| db->goodId.insert(id); | db->goodId.insert(id); | ||||
| } | } | ||||
| } else { | } else { | ||||
| db->unkId.insert(id); | db->unkId.insert(id); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| s >> banned; | s >> WithParams(CAddress::V1_DISK, banned); | ||||
| } | } | ||||
| void Add(const CAddress &addr, bool fForce = false) { | void Add(const CAddress &addr, bool fForce = false) { | ||||
| LOCK(cs); | LOCK(cs); | ||||
| Add_(addr, fForce); | Add_(addr, fForce); | ||||
| } | } | ||||
| void Add(const std::vector<CAddress> &vAddr, bool fForce = false) { | void Add(const std::vector<CAddress> &vAddr, bool fForce = false) { | ||||
| Show All 39 Lines | |||||