diff --git a/handler/tool.go b/handler/tool.go index a0e553f..27622c9 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -175,7 +175,7 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { if err != nil { log.Printf("img encode err:%v", err) worker.SetRedisSetRemove(online_conn_key, con_id) - goto end + break } buf1 := buf.GetBytes() @@ -183,7 +183,7 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { if err2 != nil { log.Printf("send message to client err:%v", err2) worker.SetRedisSetRemove(online_conn_key, con_id) - goto end + break } c = count err4 := img.Close() @@ -198,7 +198,9 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { if err != nil { log.Printf("Connection check failed:%v", err) worker.SetRedisSetRemove(online_conn_key, con_id) - goto end + break + } else { + log.Printf("Connection check success") } } } @@ -206,7 +208,6 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { t_count++ } -end: // 查看是否还有其他连接,没有则设置 is_play 为 0 if worker.IsContainKey(online_conn_key) == false { worker.SetRedisWithExpire(strconv.Itoa(device_id)+"_is_play", "1", time.Minute*5) diff --git a/service/tool.go b/service/tool.go index 5cc6e77..6431fe6 100644 --- a/service/tool.go +++ b/service/tool.go @@ -167,6 +167,8 @@ func GetDeviceCurrentFrameV3(deviceId int) (gocv.Mat, int) { } //查看地址 log.Printf("frame:%p,Device1CurrentFrame:%p,Device50CurrentFrame:%p\n", &frame, &Device1CurrentFrame, &Device50CurrentFrame) + //查看帧状态 + log.Printf("frame:%v,Device1CurrentFrame:%v,Device50CurrentFrame:%v\n", frame.Empty(), Device1CurrentFrame.Empty(), Device50CurrentFrame.Empty()) return frame, frame_count } func GetDeviceCurrentFrame(deviceId int) (gocv.Mat, int) {