mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 08:52:27 +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 {
|
func (s *ClientSession) RoomSessionId() string {
|
||||||
|
s.mu.Lock()
|
||||||
|
defer s.mu.Unlock()
|
||||||
return s.roomSessionId
|
return s.roomSessionId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,10 +1024,7 @@ func (s *ClientSession) processAsyncMessage(message *AsyncMessage) {
|
||||||
return
|
return
|
||||||
case "message":
|
case "message":
|
||||||
if message.Message.Type == "bye" && message.Message.Bye.Reason == "room_session_reconnected" {
|
if message.Message.Type == "bye" && message.Message.Bye.Reason == "room_session_reconnected" {
|
||||||
s.mu.Lock()
|
log.Printf("Closing session %s because same room session %s connected", s.PublicId(), s.RoomSessionId())
|
||||||
roomSessionId := s.RoomSessionId()
|
|
||||||
s.mu.Unlock()
|
|
||||||
log.Printf("Closing session %s because same room session %s connected", s.PublicId(), roomSessionId)
|
|
||||||
s.LeaveRoom(false)
|
s.LeaveRoom(false)
|
||||||
defer s.closeAndWait(false)
|
defer s.closeAndWait(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue