This commit is contained in:
suyl
2021-07-29 15:59:01 +08:00
parent b29bdba37f
commit 99cac55563
2 changed files with 5 additions and 2 deletions

View File

@@ -298,16 +298,20 @@ func (t *TcpClient) doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
func (t *TcpClient) HandleCheckTcpHeart() {
for {
keys := []string{}
t.RLock()
for k, v := range t.Clients {
if time.Now().Sub(v.StatusTime) > time.Minute+time.Second {
v.Status = printerStatusOffline
keys = append(keys, k)
}
}
t.RUnlock()
for _, v := range keys {
changePrinterStatus(v, printerStatusOffline)
if t.Clients[v] != nil {
if t.isExist(v) {
t.Lock()
delete(t.Clients, v)
t.Unlock()
}
}
}

View File

@@ -86,7 +86,6 @@ const (
var (
//t = &TcpClient{}
printErrMap = map[string]string{
printErrWithoutPaper: "打印机缺纸!",
}