mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-03 06:13:17 +02:00
Add missing lock for "roomSessionId" to avoid potential races.
This commit is contained in:
parent
d22b4ef2ad
commit
6da48e31b5
|
@ -150,6 +150,8 @@ func (s *ClientSession) PublicId() string {
|
|||
}
|
||||
|
||||
func (s *ClientSession) RoomSessionId() string {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.roomSessionId
|
||||
}
|
||||
|
||||
|
@ -1022,10 +1024,7 @@ func (s *ClientSession) processAsyncMessage(message *AsyncMessage) {
|
|||
return
|
||||
case "message":
|
||||
if message.Message.Type == "bye" && message.Message.Bye.Reason == "room_session_reconnected" {
|
||||
s.mu.Lock()
|
||||
roomSessionId := s.RoomSessionId()
|
||||
s.mu.Unlock()
|
||||
log.Printf("Closing session %s because same room session %s connected", s.PublicId(), roomSessionId)
|
||||
log.Printf("Closing session %s because same room session %s connected", s.PublicId(), s.RoomSessionId())
|
||||
s.LeaveRoom(false)
|
||||
defer s.closeAndWait(false)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue