This commit is contained in:
suyl
2021-08-03 15:25:21 +08:00
parent 5a2bb4aacd
commit eeddcf214e

View File

@@ -196,6 +196,8 @@ func (t *TcpClient) doPrint(key string) (err error) {
for { for {
select { select {
case <-t.TimeoutMap[key]: case <-t.TimeoutMap[key]:
close(t.MsgMap[key])
close(t.CallBackMap[key])
globals.SugarLogger.Debugf("doPrint timeout") globals.SugarLogger.Debugf("doPrint timeout")
return return
default: default:
@@ -248,9 +250,6 @@ func (t *TcpClient) doPrint(key string) (err error) {
} }
} }
} }
default:
close(t.MsgMap[key])
close(t.CallBackMap[key])
} }
} }
} }
@@ -265,6 +264,7 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) {
for { for {
select { select {
case <-t.TimeoutMap[key]: case <-t.TimeoutMap[key]:
t.Clients[key].C.Close()
globals.SugarLogger.Debugf("HandleCheckTcpHeart timeout") globals.SugarLogger.Debugf("HandleCheckTcpHeart timeout")
return return
default: default:
@@ -274,7 +274,6 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) {
changePrinterStatus(key, printerStatusOffline) changePrinterStatus(key, printerStatusOffline)
globals.SugarLogger.Debugf("HandleCheckTcpHeart clear...") globals.SugarLogger.Debugf("HandleCheckTcpHeart clear...")
//t.clear(key) //t.clear(key)
t.Clients[key].C.Close()
close(t.TimeoutMap[key]) close(t.TimeoutMap[key])
} }
} }