diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index c3f3a5418..bea4b1eb2 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -78,6 +78,7 @@ func (t *TcpClient) handleConn(c net.Conn) { //4、读打印channel并打印,并切等待回调channel中的消息 //5、修改数据库中打印机状态(没在连接池中说明是重新连接的) //6、监听心跳时间,超过2分钟就clear掉 + globals.SugarLogger.Debugf("handleConn clients map: %v", t.Clients) if t.Clients[printNo] == nil { t.addConn(c, printNo, status) t.buildCallBackMap(printNo) @@ -230,20 +231,20 @@ func (t *TcpClient) doPrint(key string) (err error) { printMsg.Status = printMsgErr printMsg.Comment = err.Error() dao.UpdateEntity(db, printMsg, "Status", "Comment") - //if t.isExist(key) { - // t.clear(key) - // close(timeoutChan) - //} - //return + if t.isExist(key) { + t.clear(key) + close(timeoutChan) + } + return } else { if c != nil { if _, err = c.Write(data); err != nil { globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err) //t.delConn(printMsg.PrintNo) - //if t.isExist(key) { - // t.clear(key) - // close(timeoutChan) - //} + if t.isExist(key) { + t.clear(key) + close(timeoutChan) + } } else { globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) //等待回调