mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-16 12:45:14 +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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still need to publish an event so sessions on other servers get notified.
|
|
||||||
r.PublishSessionLeft(session)
|
|
||||||
r.hub.removeRoom(r)
|
r.hub.removeRoom(r)
|
||||||
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeClient})
|
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeClient})
|
||||||
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeInternal})
|
r.statsRoomSessionsCurrent.Delete(prometheus.Labels{"clienttype": HelloClientTypeInternal})
|
||||||
|
@ -461,6 +459,8 @@ func (r *Room) RemoveSession(session Session) bool {
|
||||||
r.unsubscribeBackend()
|
r.unsubscribeBackend()
|
||||||
r.doClose()
|
r.doClose()
|
||||||
r.mu.Unlock()
|
r.mu.Unlock()
|
||||||
|
// Still need to publish an event so sessions on other servers get notified.
|
||||||
|
r.PublishSessionLeft(session)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,6 +564,7 @@ func (r *Room) PublishSessionLeft(session Session) {
|
||||||
func (r *Room) addInternalSessions(users []map[string]interface{}) []map[string]interface{} {
|
func (r *Room) addInternalSessions(users []map[string]interface{}) []map[string]interface{} {
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
r.mu.Lock()
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
sessionid, found := user["sessionId"]
|
sessionid, found := user["sessionId"]
|
||||||
if !found || sessionid == "" {
|
if !found || sessionid == "" {
|
||||||
|
@ -592,7 +593,6 @@ func (r *Room) addInternalSessions(users []map[string]interface{}) []map[string]
|
||||||
"virtual": true,
|
"virtual": true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
r.mu.Unlock()
|
|
||||||
return users
|
return users
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue