From f45adb5619ce46118a82815925b754f0c714ba3a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 4 Oct 2016 12:13:41 +0200 Subject: [PATCH] Merge #8862: Fix a few cases where messages were sent after requested disconnect 905bc68 net: fix a few cases where messages were sent rather than dropped upon disconnection (Cory Fields) --- src/net_processing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3cb154f76b..53dd423a4f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2436,7 +2436,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic& interruptMsg // Ping automatically sent as a latency probe & keepalive. pingSend = true; } - if (pingSend) { + if (pingSend && !pto->fDisconnect) { uint64_t nonce = 0; while (nonce == 0) { GetRandBytes((unsigned char*)&nonce, sizeof(nonce)); @@ -2517,7 +2517,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic& interruptMsg if (pindexBestHeader == NULL) pindexBestHeader = chainActive.Tip(); bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do. - if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) { + if (!state.fSyncStarted && !pto->fClient && !pto->fDisconnect && !fImporting && !fReindex) { // Only actively request headers from a single peer, unless we're close to end of initial download. if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 6 * 60 * 60) { // NOTE: was "close to today" and 24h in Bitcoin state.fSyncStarted = true;