diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 6d65a23fa..5db637ccc 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -231,10 +231,8 @@ func (t *TcpClient) doPrint(key string) (err error) { printMsg.Comment = err.Error() dao.UpdateEntity(db, printMsg, "Status", "Comment") if t.isExist(key) { - timeoutChan <- 1 - timeoutChan <- 1 - timeoutChan <- 1 t.clear(key) + close(timeoutChan) } return } else { @@ -243,10 +241,8 @@ func (t *TcpClient) doPrint(key string) (err error) { globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err) //t.delConn(printMsg.PrintNo) if t.isExist(key) { - timeoutChan <- 1 - timeoutChan <- 1 - timeoutChan <- 1 t.clear(key) + close(timeoutChan) } return } else { @@ -279,10 +275,8 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) { if time.Now().Sub(t.getPrintStatusTime(key)) > time.Minute*2 { changePrinterStatus(key, printerStatusOffline) if t.isExist(key) { - timeoutChan <- 1 - timeoutChan <- 1 - timeoutChan <- 1 t.clear(key) + close(timeoutChan) return } } diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index 6bf53f44b..3d61b612e 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -108,7 +108,7 @@ var ( regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE) regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE) - timeoutChan = make(chan int, 3) + timeoutChan = make(chan bool) ) type PrintInfo struct {