From: qydysky Date: Sun, 21 May 2023 01:57:26 +0000 (+0800) Subject: Fix 直播流回放连接限制 X-Git-Tag: v0.9.6~7 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=6ea019d187e7d4dcc6e8717f85076e06054814eb;p=bili_danmu%2F.git Fix 直播流回放连接限制 --- 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) }