This commit is contained in:
suyl
2021-08-03 15:39:38 +08:00
parent eeddcf214e
commit 8de2b13d5f

View File

@@ -196,14 +196,13 @@ 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:
select { select {
case printMsg, ok := <-t.MsgMap[key]: case printMsg, ok := <-t.MsgMap[key]:
if !ok { if !ok {
globals.SugarLogger.Debugf("doPrint err !ok ...")
return return
} }
var ( var (
@@ -265,6 +264,8 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) {
select { select {
case <-t.TimeoutMap[key]: case <-t.TimeoutMap[key]:
t.Clients[key].C.Close() t.Clients[key].C.Close()
close(t.MsgMap[key])
close(t.CallBackMap[key])
globals.SugarLogger.Debugf("HandleCheckTcpHeart timeout") globals.SugarLogger.Debugf("HandleCheckTcpHeart timeout")
return return
default: default: