Skip to content

Commit

Permalink
Only disconnect stalled peers if IsSyncing
Browse files Browse the repository at this point in the history
  • Loading branch information
projectmemetic committed Feb 26, 2019
1 parent 6960e27 commit a8efc35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5062,7 +5062,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
// Detect stalled peers.
int nSyncTimeout = GetArg("-synctimeout", 60);
int64_t tNow = GetTimeMillis();
if (pto->tGetblocks) {
if (pto->tGetblocks && IsSyncing()) {
if (pto->tBlockRecving > pto->tBlockRecved) {
if (tNow-pto->tBlockRecving > nSyncTimeout * 1000) {
LogPrintf("sync peer=%d: Block download stalled for over %d seconds.\n", pto->id, nSyncTimeout);
Expand Down
4 changes: 2 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ void ThreadSocketHandler()
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
MilliSleep(2); // niceness
MilliSleep(1); // niceness
}
}

Expand Down Expand Up @@ -1568,7 +1568,7 @@ void ThreadMessageHandler(int ncore)
}

// niceness
MilliSleep(3);
MilliSleep(2);
}
}

Expand Down

0 comments on commit a8efc35

Please sign in to comment.