Increased timeout for onion peers

This commit is contained in:
Pieter Wuille 2012-09-29 18:08:21 +02:00
parent c92918f379
commit a4e78e5cf7
1 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,13 @@ class CNode {
int64 doneAfter;
CAddress you;
int GetTimeout() {
if (you.IsTor())
return 60;
else
return 10;
}
void BeginMessage(const char *pszCommand) {
if (nHeaderStart != -1) AbortMessage();
nHeaderStart = vSend.size();
@ -84,7 +91,7 @@ class CNode {
// printf("\n%s: version %i\n", ToString(you).c_str(), nVersion);
BeginMessage("getaddr");
EndMessage();
doneAfter = time(NULL) + 10;
doneAfter = time(NULL) + GetTimeout();
}
bool ProcessMessage(string strCommand, CDataStream& vRecv) {
@ -217,7 +224,7 @@ public:
wa.tv_sec = doneAfter - now;
wa.tv_usec = 0;
} else {
wa.tv_sec = 10;
wa.tv_sec = GetTimeout();
wa.tv_usec = 0;
}
int ret = select(sock+1, &set, NULL, &set, &wa);