Skip to content

Commit d93f0c6

Browse files
committed
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)
2 parents 7dce175 + 905bc68 commit d93f0c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6351,7 +6351,7 @@ bool SendMessages(CNode* pto, CConnman& connman)
63516351
// Ping automatically sent as a latency probe & keepalive.
63526352
pingSend = true;
63536353
}
6354-
if (pingSend) {
6354+
if (pingSend && !pto->fDisconnect) {
63556355
uint64_t nonce = 0;
63566356
while (nonce == 0) {
63576357
GetRandBytes((unsigned char*)&nonce, sizeof(nonce));
@@ -6432,7 +6432,7 @@ bool SendMessages(CNode* pto, CConnman& connman)
64326432
if (pindexBestHeader == NULL)
64336433
pindexBestHeader = chainActive.Tip();
64346434
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.
6435-
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) {
6435+
if (!state.fSyncStarted && !pto->fClient && !pto->fDisconnect && !fImporting && !fReindex) {
64366436
// Only actively request headers from a single peer, unless we're close to today.
64376437
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
64386438
state.fSyncStarted = true;

0 commit comments

Comments
 (0)