From: Matt Joiner Date: Tue, 12 Oct 2021 02:06:59 +0000 (+1100) Subject: Panic if pending request count goes negative in requesting X-Git-Tag: v1.34.0^2~39 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8b90e737c8a64e58d943339c84a7d8009ee58418;p=btrtrc.git Panic if pending request count goes negative in requesting --- diff --git a/requesting.go b/requesting.go index d4311413..c1575885 100644 --- a/requesting.go +++ b/requesting.go @@ -144,6 +144,12 @@ func (p *peerRequests) Less(i, j int) bool { if current { ret-- } + // I have a hunch that this could trigger for requests for chunks that are choked and not + // allowed fast, since the current conn shouldn't already be included. It's a very specific + // circumstance, and if it triggers I will fix it. + if ret < 0 { + panic(ret) + } return ret } ml := multiless.New()