merge ping and stale check
This commit is contained in:
parent
80ddfe57f4
commit
c1f158f42a
1 changed files with 1 additions and 7 deletions
|
@ -30,13 +30,7 @@ func RemoveStaleClients() {
|
|||
for range ticker.C {
|
||||
mu.Lock()
|
||||
for _, client := range Clients {
|
||||
if !sendPing(client) {
|
||||
client.Conn.Close()
|
||||
delete(Clients, client.Conn.LocalAddr())
|
||||
|
||||
}
|
||||
|
||||
if isStale(client) {
|
||||
if !sendPing(client) || isStale(client) {
|
||||
client.Conn.Close()
|
||||
delete(Clients, client.Conn.LocalAddr())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue