From 14e2d7f9ac83d22ea7231fd9f69b36a204afd721 Mon Sep 17 00:00:00 2001 From: bitflash-maintainer Date: Wed, 12 Aug 2026 16:08:22 +0000 Subject: net: time the stall, not the wait, before dropping an unreadable peer Found auditing the previous commit for the push. Timing from the first rewind would drop a peer whose message is large and merely slow, which would be a fault of our own making rather than one we fixed. Restart the clock whenever the buffer has grown by even one byte since the last look. A transfer still making progress is never dropped however long it takes; only one that has stopped growing while the node goes on expecting more is, which is the actual failure. (cherry picked from commit 5dddb26bae02013ce87719b11953aadf0bfa2594) --- src/net.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/net.h b/src/net.h index 112426e..440550c 100644 --- a/src/net.h +++ b/src/net.h @@ -670,9 +670,13 @@ public: string strBtfAddr; string strBtfMeeting; - // When this peer's message loop first rewound a header to wait for the - // rest of a message, or 0 when it is not waiting. See ProcessMessages. + // When this peer's message loop last rewound a header without having made + // progress, or 0 when it is not waiting, plus how much was buffered then. + // The pair times a STALL rather than a duration, so a large message + // arriving slowly is never mistaken for one that is never arriving. + // See ProcessMessages. int64 nMsgWaitSince; + unsigned int nMsgWaitSize; // Height this peer announced in its version message, or -1 if it sent a // version message that predates the field. Knowing how far along everyone -- cgit v1.2.3