websocket-based lrcproto server

defer unlock

+2 -3
+2 -3
server.go
··· 495 495 func (s *Server) handleMute(msg *lrcpb.Event_Mute, client *client) { 496 496 toMute := msg.Mute.GetId() 497 497 s.idmapsMu.Lock() 498 + defer s.idmapsMu.Unlock() 498 499 clientToMute, ok := s.idToClient[toMute] 499 500 if !ok { 500 501 return ··· 504 505 } 505 506 clientToMute.mutedBy[client] = true 506 507 client.muteMap[clientToMute] = true 507 - s.idmapsMu.Unlock() 508 508 509 509 } 510 510 511 511 func (s *Server) handleUnmute(msg *lrcpb.Event_Unmute, client *client) { 512 512 toMute := msg.Unmute.GetId() 513 513 s.idmapsMu.Lock() 514 + defer s.idmapsMu.Unlock() 514 515 clientToMute, ok := s.idToClient[toMute] 515 516 if !ok { 516 517 return ··· 520 521 } 521 522 delete(clientToMute.mutedBy, client) 522 523 delete(client.muteMap, clientToMute) 523 - s.idmapsMu.Unlock() 524 - 525 524 } 526 525 527 526 func (s *Server) handleSet(msg *lrcpb.Event_Set, client *client) {