Merge #38: Wait for more than a single addr to come back

e27d6c5 Adjust protocol timeouts (Pieter Wuille)
a9e960a Wait until we have more than a single addr response (Pieter Wuille)
This commit is contained in:
Pieter Wuille 2016-06-01 12:43:43 +02:00
commit 9c32351efd
No known key found for this signature in database
GPG key ID: DBA1A67379A1A931
2 changed files with 6 additions and 4 deletions

View file

@ -26,9 +26,9 @@ class CNode {
int GetTimeout() { int GetTimeout() {
if (you.IsTor()) if (you.IsTor())
return 60; return 120;
else else
return 10; return 30;
} }
void BeginMessage(const char *pszCommand) { void BeginMessage(const char *pszCommand) {
@ -136,7 +136,9 @@ class CNode {
// printf("%s: got %i addresses\n", ToString(you).c_str(), (int)vAddrNew.size()); // printf("%s: got %i addresses\n", ToString(you).c_str(), (int)vAddrNew.size());
int64 now = time(NULL); int64 now = time(NULL);
vector<CAddress>::iterator it = vAddrNew.begin(); vector<CAddress>::iterator it = vAddrNew.begin();
if (vAddrNew.size() > 1) {
if (doneAfter == 0 || doneAfter > now + 1) doneAfter = now + 1; if (doneAfter == 0 || doneAfter > now + 1) doneAfter = now + 1;
}
while (it != vAddrNew.end()) { while (it != vAddrNew.end()) {
CAddress &addr = *it; CAddress &addr = *it;
// printf("%s: got address %s\n", ToString(you).c_str(), addr.ToString().c_str(), (int)(vAddr->size())); // printf("%s: got address %s\n", ToString(you).c_str(), addr.ToString().c_str(), (int)(vAddr->size()));

View file

@ -159,7 +159,7 @@ extern "C" void* ThreadCrawler(void* data) {
res.nClientV = 0; res.nClientV = 0;
res.nHeight = 0; res.nHeight = 0;
res.strClientV = ""; res.strClientV = "";
bool getaddr = res.ourLastSuccess + 604800 < now; bool getaddr = res.ourLastSuccess + 86400 < now;
res.fGood = TestNode(res.service,res.nBanTime,res.nClientV,res.strClientV,res.nHeight,getaddr ? &addr : NULL); res.fGood = TestNode(res.service,res.nBanTime,res.nClientV,res.strClientV,res.nHeight,getaddr ? &addr : NULL);
} }
db.ResultMany(ips); db.ResultMany(ips);