mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-23 16:02:12 +02:00
Fix deadlock if virtual session leaves room.
This commit is contained in:
parent
5fc61b15b6
commit
d1c5d785c8
6
room.go
6
room.go
|
@ -452,8 +452,6 @@ func (r *Room) RemoveSession(session Session) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Still need to publish an event so sessions on other servers get notified.
|
||||
r.PublishSessionLeft(session)
|
||||
r.hub.removeRoom(r)
|
||||
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeClient})
|
||||
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeInternal})
|
||||
|
@ -461,6 +459,8 @@ func (r *Room) RemoveSession(session Session) bool {
|
|||
r.unsubscribeBackend()
|
||||
r.doClose()
|
||||
r.mu.Unlock()
|
||||
// Still need to publish an event so sessions on other servers get notified.
|
||||
r.PublishSessionLeft(session)
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -564,6 +564,7 @@ func (r *Room) PublishSessionLeft(session Session) {
|
|||
func (r *Room) addInternalSessions(users []map[string]interface{}) []map[string]interface{} {
|
||||
now := time.Now().Unix()
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
for _, user := range users {
|
||||
sessionid, found := user["sessionId"]
|
||||
if !found || sessionid == "" {
|
||||
|
@ -592,7 +593,6 @@ func (r *Room) addInternalSessions(users []map[string]interface{}) []map[string]
|
|||
"virtual": true,
|
||||
})
|
||||
}
|
||||
r.mu.Unlock()
|
||||
return users
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue