diff --git a/handler/tool.go b/handler/tool.go index 525e65f..87decff 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -235,6 +235,10 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { worker.SetRedisSetRemove(online_conn_key, con_id) break } + t++ + if t%10 == 0 { + log.Printf("device:%d send frame count:%d,img is closed", device_id, c) + } buf1 := buf.GetBytes() err2 := ws.WriteMessage(websocket.BinaryMessage, buf1) @@ -244,10 +248,6 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { break } c = count - t++ - if t%10 == 0 { - log.Printf("device:%d send frame count:%d,img is closed", device_id, c) - } err5 := img.Close() if err5 != nil { log.Printf("img close err:%v", err)