This commit is contained in:
suyl
2021-08-03 11:28:16 +08:00
parent 8e44870cbf
commit f3aaacae0a
2 changed files with 4 additions and 4 deletions

View File

@@ -234,7 +234,6 @@ func (t *TcpClient) doPrint(key string) (err error) {
dao.UpdateEntity(db, printMsg, "Status", "Comment")
if t.isExist(key) {
t.clear(key)
close(t.TimeoutMap[key])
}
return
} else {
@@ -244,8 +243,8 @@ func (t *TcpClient) doPrint(key string) (err error) {
//t.delConn(printMsg.PrintNo)
if t.isExist(key) {
t.clear(key)
close(t.TimeoutMap[key])
}
return
} else {
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
//等待回调
@@ -278,9 +277,8 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) {
changePrinterStatus(key, printerStatusOffline)
if t.isExist(key) {
t.clear(key)
close(t.TimeoutMap[key])
return
}
return
}
}
}

View File

@@ -280,6 +280,8 @@ func (t *TcpClient) clear(key string) {
delete(t.MsgMap, key)
close(t.CallBackMap[key])
delete(t.CallBackMap, key)
close(t.TimeoutMap[key])
delete(t.TimeoutMap, key)
}
func NewTcpClient() *TcpClient {