updated remove func name

main
alex 2023-05-26 23:58:57 +02:00
parent 003c9d3eb3
commit 8bade7992d
1 changed files with 2 additions and 25 deletions

View File

@ -21,7 +21,7 @@ func DeleteClientByConn(conn *websocket.Conn) {
for i := 0; i < len(socketClients); i++ {
if socketClients[i].Conn == conn {
socketClients = remove(socketClients, i)
socketClients = removeSocketClient(socketClients, i)
break
}
}
@ -29,7 +29,7 @@ func DeleteClientByConn(conn *websocket.Conn) {
mu.Unlock()
}
func remove(s []*structs.SocketClient, i int) []*structs.SocketClient {
func removeSocketClient(s []*structs.SocketClient, i int) []*structs.SocketClient {
return append(s[:i], s[i+1:]...)
}
@ -39,26 +39,3 @@ func GetSocketClients() []*structs.SocketClient {
return socketClients
}
/*
func GetSocketClient(sessionId string) (socketClient *structs.SocketClient, ok bool) {
mu.RLock()
defer mu.RUnlock()
client, ok := socketClients[sessionId]
return client, ok
}
func GetSocketClientByConn(conn *websocket.Conn) (socketClient *structs.SocketClient, err error) {
mu.RLock()
defer mu.RUnlock()
for _, client := range socketClients {
if client.Conn == conn {
return client, nil
}
}
return nil, errors.New("Failed to find socket client by ws conn")
}*/