From 6ea019d187e7d4dcc6e8717f85076e06054814eb Mon Sep 17 00:00:00 2001 From: qydysky Date: Sun, 21 May 2023 09:57:26 +0800 Subject: [PATCH] =?utf8?q?Fix=20=E7=9B=B4=E6=92=AD=E6=B5=81=E5=9B=9E?= =?utf8?q?=E6=94=BE=E8=BF=9E=E6=8E=A5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/F.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Reply/F.go b/Reply/F.go index 58f3f09..087c924 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -1274,7 +1274,11 @@ func init() { w.WriteHeader(http.StatusTooManyRequests) return } else { - defer limitCon.Add(-1) + // 连接退出 + go func() { + <-r.Context().Done() + limitCon.Add(-1) + }() } } @@ -1348,7 +1352,6 @@ func init() { speed = s } } - if e := f.CopyToIoWriter(w, int64(speed), true); e != nil { flog.L(`E: `, e) } -- 2.39.2