feat: remove unused client mutex
- remove unused Mutex from `models.Client` struct
- remove lock from `HandleConnection()`
- replace websocket.Conn with models.Client in `handleClientCommands()`
🤖
This commit is contained in:
parent
94b6786c7c
commit
bdfd5c3b84
3 changed files with 8 additions and 12 deletions
|
@ -31,12 +31,13 @@ func HandleConnection(w http.ResponseWriter, r *http.Request) {
|
|||
log.Info("Client connected", "host", ws.NetConn().RemoteAddr(), "clients", len(Clients)+1)
|
||||
|
||||
// Register the new client
|
||||
mu.Lock()
|
||||
Clients[ws] = &models.Client{
|
||||
Conn: ws, // Store the WebSocket connection
|
||||
client := models.Client{
|
||||
Conn: ws,
|
||||
}
|
||||
mu.Lock()
|
||||
Clients[ws] = &client
|
||||
mu.Unlock()
|
||||
|
||||
// Listen for commands from the connected client
|
||||
handleClientCommands(ws)
|
||||
handleClientCommands(client)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue