From b42b66bc8f90b32791ca896190608badc42c73c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 16 Mar 2023 11:08:05 +0800 Subject: [PATCH] 1 --- business/jxstore/event/event_tcp.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 084a98001..eb84d071d 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -79,7 +79,6 @@ func (t *TcpClient) handleConn(c net.Conn) error { if strings.Contains(data, heartText) || strings.Contains(data, heartTextNew) { printNoData, _ := hex.DecodeString(data[len(heartText) : len(data)-8]) printNo = string(printNoData) - globals.SugarLogger.Debugf("TimeoutMap 1:%s", utils.Format4Output(t.TimeoutMap[printNo], false)) status := printStatus2JxStatus(data[len(data)-8 : len(data)-6]) //如果没在连接池里 //1、加到连接池中,不同的打印机no开不同的goroutine @@ -92,7 +91,6 @@ func (t *TcpClient) handleConn(c net.Conn) error { t.addConn(c, printNo, status) t.buildAllMap(printNo) t.HandleTcpMessages(printNo) - globals.SugarLogger.Debugf("TimeoutMap 3:%s", utils.Format4Output(t.TimeoutMap[printNo], false)) t.doPrint(printNo) if status == printerStatusOnline { //t.printFail() @@ -182,7 +180,6 @@ func (t *TcpClient) HandleTcpMessages(printNo string) { for { select { case <-t.TimeoutMap[printNo]: - globals.SugarLogger.Debugf("TimeoutMap :%s", utils.Format4Output(t.TimeoutMap[printNo], false)) globals.SugarLogger.Debugf("HandleTcpMessages timeout") return default: @@ -317,7 +314,7 @@ func (t *TcpClient) doPrint(key string) (err error) { //检测心跳 func (t *TcpClient) HandleCheckTcpHeart(key string) { - globals.SugarLogger.Debugf("HandleCheckTcpHeart begin key: %v", <-t.TimeoutMap[key]) + globals.SugarLogger.Debugf("HandleCheckTcpHeart begin key: %s", key) go func() { for { select { @@ -326,7 +323,6 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) { close(t.MsgMap[key]) close(t.CallBackMap[key]) t.delConn(key) - close(t.TimeoutMap[key]) //delete(t.Clients, key) return default: @@ -335,8 +331,8 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) { //1分钟内没心跳判断打印机掉线了 if time.Now().Sub(statusTime) > time.Minute+time.Second*10 { changePrinterStatus(key, printerStatusOffline) + //t.clear(key) close(t.TimeoutMap[key]) - t.clear(key) } } }