mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-28 21:51:57 -08:00
Use a map instead of slices for storing client pointers in the Server struct.
This commit is contained in:
parent
122b6af163
commit
a57908b487
3 changed files with 99 additions and 101 deletions
|
|
@ -57,7 +57,7 @@ type Message struct {
|
|||
// is ignored for UDP packets.
|
||||
kind uint16
|
||||
|
||||
// For UDP datagrams one of these fiels have to be filled out.
|
||||
// For UDP datagrams one of these fields have to be filled out.
|
||||
// If there is no connection established, address must be used.
|
||||
// If the datagram comes from an already-connected client, the
|
||||
// client field should point to that client.
|
||||
|
|
@ -143,7 +143,10 @@ func (server *Server) handleTextMessage(client *Client, msg *Message) {
|
|||
|
||||
users := []*Client{};
|
||||
for i := 0; i < len(txtmsg.Session); i++ {
|
||||
user := server.getClient(txtmsg.Session[i])
|
||||
user, ok := server.clients[txtmsg.Session[i]]
|
||||
if !ok {
|
||||
log.Panic("Could not look up client by session")
|
||||
}
|
||||
users = append(users, user)
|
||||
}
|
||||
|
||||
|
|
@ -170,4 +173,5 @@ func (server *Server) handleUserStatsMessage(client *Client, msg *Message) {
|
|||
if err != nil {
|
||||
client.Panic(err.String())
|
||||
}
|
||||
log.Printf("UserStatsMessage")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue