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

@@ -76,7 +76,6 @@ func (t *TcpClient) handleConn(c net.Conn) {
globals.SugarLogger.Debugf("handleConn printno :[%v]", printNo)
status := printStatus2JxStatus(data[len(data)-8 : len(data)-6])
if t.Clients[printNo] == nil {
timeoutChan <- 1
t.addConn(c, printNo, status)
t.buildCallBackMap(printNo)
t.buildMsgMap(printNo)
@@ -219,7 +218,6 @@ func (t *TcpClient) doPrint(key string) (err error) {
}
}
}
case <-timeoutChan:
}
}
}()

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
}