Browse Source

more compact CAddrInfo serialization + bugfix

pull/1/head
Pieter Wuille 13 years ago
parent
commit
0553a002d4
  1. 4
      db.cpp
  2. 4
      db.h

4
db.cpp

@ -61,7 +61,7 @@ bool CAddrDb::Get_(CIPPort &ip, int &wait) {
} }
unkId.erase(ret); unkId.erase(ret);
} else { } else {
int ret = ourId.front(); ret = ourId.front();
if (time(NULL) - idToInfo[ret].ourLastTry < MIN_RETRY) return false; if (time(NULL) - idToInfo[ret].ourLastTry < MIN_RETRY) return false;
ourId.pop_front(); ourId.pop_front();
} }
@ -169,7 +169,7 @@ void CAddrDb::Add_(const CAddress &addr) {
int id = nId++; int id = nId++;
idToInfo[id] = ai; idToInfo[id] = ai;
ipToId[ipp] = id; ipToId[ipp] = id;
printf("%s: added\n", ToString(ipp).c_str(), ipToId[ipp]); // printf("%s: added\n", ToString(ipp).c_str(), ipToId[ipp]);
unkId.insert(id); unkId.insert(id);
nDirty++; nDirty++;
} }

4
db.h

@ -100,6 +100,9 @@ public:
READWRITE(ip); READWRITE(ip);
READWRITE(services); READWRITE(services);
READWRITE(lastTry); READWRITE(lastTry);
unsigned char tried = ourLastTry != 0;
READWRITE(tried);
if (tried) {
READWRITE(ourLastTry); READWRITE(ourLastTry);
READWRITE(ignoreTill); READWRITE(ignoreTill);
READWRITE(stat2H); READWRITE(stat2H);
@ -109,6 +112,7 @@ public:
READWRITE(total); READWRITE(total);
READWRITE(success); READWRITE(success);
READWRITE(clientVersion); READWRITE(clientVersion);
}
) )
}; };

Loading…
Cancel
Save