Permalink
Browse files

Increased timeout for onion peers

  • Loading branch information...
1 parent c92918f commit a4e78e5cf76e63e1476898af3368e0cd344834ea @sipa committed Sep 29, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 bitcoin.cpp
View
11 bitcoin.cpp
@@ -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 @@ class CNode {
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);

0 comments on commit a4e78e5

Please sign in to comment.