From 14a1403936f96af8bb950e05f502f379c07cfc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Oct 2022 15:34:45 +0800 Subject: [PATCH] 1 --- business/jxstore/event/event_tcp.go | 3 ++- business/jxstore/event/event_tcp_utils.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 36a2715be..1df2756c5 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -81,6 +81,7 @@ func (t *TcpClient) handleConn(c net.Conn) { //6、监听心跳时间,超过1分多钟就clear掉 //globals.SugarLogger.Debugf("handleConn timeout channel...: %v", t.TimeoutMap[printNo]) if t.Clients[printNo] == nil { + globals.SugarLogger.Debugf("==========print_no:%s", printNo) t.addConn(c, printNo, status) t.buildAllMap(printNo) t.HandleTcpMessages(printNo) @@ -96,7 +97,7 @@ func (t *TcpClient) handleConn(c net.Conn) { } } else { //在加到连接池中已经更新了时间,所以放在else里 - t.setPrintStatusTime(printNo) + t.setPrintStatusTime(c, status, printNo) } //状态不一致再更新状态(可能缺纸了,过热了等) if t.getPrintStatus(printNo) != status { diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index c0b75ef2f..d23844ef8 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -255,12 +255,14 @@ func (t *TcpClient) setPrintStatus(key string, status int) { } } -func (t *TcpClient) setPrintStatusTime(key string) { +func (t *TcpClient) setPrintStatusTime(c net.Conn, status int, key string) { t.Lock() defer t.Unlock() if t.Clients[key] != nil { //t.Clients[key].Status = status t.Clients[key].StatusTime = time.Now() + t.Clients[key].C = c + t.Clients[key].Status = status } }