From: Matt Joiner Date: Wed, 6 Aug 2025 12:56:36 +0000 (+1000) Subject: Lower webseed read chunks log level when peer is closed X-Git-Tag: v1.59.0~2^2~37 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=548da6164834468307513e2f379f6cf9356f9cdd;p=btrtrc.git Lower webseed read chunks log level when peer is closed --- diff --git a/webseed-peer.go b/webseed-peer.go index b1ff7dd4..cf3a9e01 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -173,10 +173,13 @@ func (me *webseedPeer) hasOverlappingRequests(begin, end RequestIndex) bool { return false } -func readChunksErrorLevel(err error, req *webseedRequest) slog.Level { +func (ws *webseedPeer) readChunksErrorLevel(err error, req *webseedRequest) slog.Level { if req.cancelled.Load() { return slog.LevelDebug } + if ws.peer.closedCtx.Err() != nil { + return slog.LevelDebug + } var h2e http2.GoAwayError if errors.As(err, &h2e) { if h2e.ErrCode == http2.ErrCodeEnhanceYourCalm { @@ -200,7 +203,7 @@ func (ws *webseedPeer) runRequest(webseedRequest *webseedRequest) { // Ensure the body reader and response are closed. webseedRequest.Close() if err != nil { - level := readChunksErrorLevel(err, webseedRequest) + level := ws.readChunksErrorLevel(err, webseedRequest) ws.slogger().Log(context.TODO(), level, "webseed request error", "err", err) torrent.Add("webseed request error count", 1) // This used to occur only on webseed.ErrTooFast but I think it makes sense to slow down any