p2p/discover: always increment TALKREQ drop counter on timeout (#35243)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Increment `dropCount` on every TALKREQ dropped due to overload timeout.
Previously the counter was only updated when the throttled warning log
was emitted.
This commit is contained in:
cui 2026-07-03 19:13:46 +08:00 committed by GitHub
parent 3006c4411b
commit 6eae868a95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,10 +102,10 @@ func (t *talkSystem) handleRequest(id enode.ID, addr netip.AddrPort, req *v5wire
}()
case <-timeout.C:
// Couldn't get it in time, drop the request.
t.dropCount++
if time.Since(t.lastLog) > 5*time.Second {
log.Warn("Dropping TALKREQ due to overload", "ndrop", t.dropCount)
t.lastLog = time.Now()
t.dropCount++
}
case <-t.transport.closeCtx.Done():
// Transport closed, drop the request.