aa
This commit is contained in:
@@ -364,12 +364,17 @@ func HandleTcpMessages() {
|
||||
func HandleCheckTcpHeart() {
|
||||
for {
|
||||
tcpClient.s.Lock()
|
||||
for _, v := range tcpClient.Clients {
|
||||
keys := []string{}
|
||||
for k, v := range tcpClient.Clients {
|
||||
if time.Now().Sub(v.StatusTime) > time.Minute+time.Second {
|
||||
v.Status = printerStatusOffline
|
||||
keys = append(keys, k)
|
||||
}
|
||||
}
|
||||
tcpClient.s.Unlock()
|
||||
for _, v := range keys {
|
||||
delete(tcpClient.Clients, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user