This commit is contained in:
suyl
2021-07-30 18:48:03 +08:00
parent e55d4dfd4f
commit 9861e3edc5
2 changed files with 3 additions and 4 deletions

View File

@@ -241,8 +241,9 @@ func (t *TcpClient) addMsgChan(printMsg *model.PrintMsg) {
func (t *TcpClient) addCallbackChan(key, data string) {
t.Lock()
defer t.Unlock()
if !t.isExistCallback(key) {
t.buildCallBackMap(key)
if t.CallBackMap[key] == nil {
dataChan := make(chan string, 1024)
t.CallBackMap[key] = dataChan
}
t.CallBackMap[key] <- data
}