fix stale logic

This commit is contained in:
Sebastian Mark 2024-11-21 19:25:42 +01:00
parent 92260b44db
commit b0b6c702da

View file

@ -16,7 +16,7 @@ func RemoveStaleClients() {
for range ticker.C { for range ticker.C {
mu.Lock() mu.Lock()
for _, client := range Clients { for _, client := range Clients {
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)