fix: add more mutex locks for Clients
map
This commit is contained in:
parent
ab2e8c161d
commit
064a720436
2 changed files with 4 additions and 0 deletions
|
@ -22,7 +22,9 @@ func handleClientCommands(c models.WebsocketClient) {
|
|||
_, message, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
// remove client on error/disconnect
|
||||
mu.Lock()
|
||||
delete(Clients, ws.LocalAddr())
|
||||
mu.Unlock()
|
||||
helper.Logger.Info("Client disconnected:", "msg", err, "host", c.RealIP, "clients", len(Clients))
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue