Compare commits
2 commits
55f7ecae6b
...
6f355fe441
Author | SHA1 | Date | |
---|---|---|---|
6f355fe441 | |||
a98b4bc154 |
1 changed files with 2 additions and 1 deletions
|
@ -19,7 +19,7 @@ func RemoveStaleClients() {
|
||||||
if !sendPing(client) || isStale(client) {
|
if !sendPing(client) || isStale(client) {
|
||||||
client.Conn.Close()
|
client.Conn.Close()
|
||||||
delete(Clients, client.Conn.LocalAddr())
|
delete(Clients, client.Conn.LocalAddr())
|
||||||
helper.Logger.Info("Removed stale client", "host", client.RealIP)
|
helper.Logger.Info("Removed stale client", "host", client.RealIP, "lastPong", client.LastPong)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
@ -31,6 +31,7 @@ func sendPing(client *models.WebsocketClient) bool {
|
||||||
err := client.Conn.WriteMessage(websocket.PingMessage, nil)
|
err := client.Conn.WriteMessage(websocket.PingMessage, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
helper.Logger.Debug("ping failed", "host", client.RealIP)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue