diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-10-04 12:13:41 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-10-04 12:13:50 +0200 |
commit | d93f0c61843f9da2a662f54ea1794ae0d263b196 (patch) | |
tree | e2ec02343373e60b81803a742de92e3f8a19bdf3 /src | |
parent | 7dce175f5d89c9185f4cd7bfbd7626205b122001 (diff) | |
parent | 905bc68d05595f41cca36b3df83accd10c00cc48 (diff) |
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)
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index ab67219714..437e972382 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6351,7 +6351,7 @@ bool SendMessages(CNode* pto, CConnman& connman) // 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)); @@ -6432,7 +6432,7 @@ bool SendMessages(CNode* pto, CConnman& connman) 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 today. if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { state.fSyncStarted = true; |