From 31d28cbff27c879dce3cf2894ff26dcf8fd5e830 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Thu, 26 Dec 2024 14:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E6=B5=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/device.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/handler/device.go b/handler/device.go index aa28387..253df8e 100644 --- a/handler/device.go +++ b/handler/device.go @@ -412,7 +412,12 @@ func VideoFeed(c *gin.Context) { // 启动一个协程来监测客户端连接是否关闭,关闭时向 clientClosed 通道发送信号 go func() { <-c.Request.Context().Done() - clientClosed <- struct{}{} + //如果clientClosed通道已经关闭,不再发送 + if _, ok := <-clientClosed; !ok { + return + } else { + clientClosed <- struct{}{} + } }() // 查看是否还有其他连接,没有则设置 is_play 为 0