This commit is contained in:
邹宗楠
2022-10-21 15:36:45 +08:00
parent 14a1403936
commit 80e8bbcda8
2 changed files with 2 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ func (t *TcpClient) handleConn(c net.Conn) {
} }
} else { } else {
//在加到连接池中已经更新了时间所以放在else里 //在加到连接池中已经更新了时间所以放在else里
t.setPrintStatusTime(c, status, printNo) t.setPrintStatusTime(printNo)
} }
//状态不一致再更新状态(可能缺纸了,过热了等) //状态不一致再更新状态(可能缺纸了,过热了等)
if t.getPrintStatus(printNo) != status { if t.getPrintStatus(printNo) != status {

View File

@@ -255,14 +255,12 @@ func (t *TcpClient) setPrintStatus(key string, status int) {
} }
} }
func (t *TcpClient) setPrintStatusTime(c net.Conn, status int, key string) { func (t *TcpClient) setPrintStatusTime(key string) {
t.Lock() t.Lock()
defer t.Unlock() defer t.Unlock()
if t.Clients[key] != nil { if t.Clients[key] != nil {
//t.Clients[key].Status = status //t.Clients[key].Status = status
t.Clients[key].StatusTime = time.Now() t.Clients[key].StatusTime = time.Now()
t.Clients[key].C = c
t.Clients[key].Status = status
} }
} }