This commit is contained in:
suyl
2021-08-03 13:50:10 +08:00
parent ef3f7ff68b
commit e11c25444c
2 changed files with 14 additions and 11 deletions

View File

@@ -172,6 +172,14 @@ func (t *TcpClient) buildTimeoutMap(key string) {
t.TimeoutMap[key] = dataChan
}
func (t *TcpClient) buildAllMap(key string) {
t.Lock()
defer t.Unlock()
t.MsgMap[key] = make(chan *model.PrintMsg, 1024)
t.CallBackMap[key] = make(chan string, 1024)
t.TimeoutMap[key] = make(chan bool)
}
func (t *TcpClient) getPrintStatus(key string) int {
t.RLock()
defer t.RUnlock()
@@ -275,11 +283,11 @@ func (t *TcpClient) clear(key string) {
t.Lock()
defer t.Unlock()
t.Clients[key].C.Close()
delete(t.Clients, key)
close(t.MsgMap[key])
delete(t.MsgMap, key)
close(t.CallBackMap[key])
delete(t.CallBackMap, key)
//delete(t.Clients, key)
//close(t.MsgMap[key])
//delete(t.MsgMap, key)
//close(t.CallBackMap[key])
//delete(t.CallBackMap, key)
close(t.TimeoutMap[key])
delete(t.TimeoutMap, key)
}