mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-04 14:53:10 +02:00
Check backend when searching for session to use for dialout.
This commit is contained in:
parent
29d10f3723
commit
c72c821687
|
@ -685,13 +685,7 @@ func (b *BackendServer) startDialout(roomid string, backend *Backend, request *B
|
|||
return returnDialoutError(http.StatusBadRequest, NewError("invalid_roomid", "The room id must be numeric."))
|
||||
}
|
||||
|
||||
var session *ClientSession
|
||||
for s := range b.hub.dialoutSessions {
|
||||
if s.GetClient() != nil {
|
||||
session = s
|
||||
break
|
||||
}
|
||||
}
|
||||
session := b.hub.GetDialoutSession(roomid, backend)
|
||||
if session == nil {
|
||||
return returnDialoutError(http.StatusNotFound, NewError("no_client_available", "No available client found to trigger dialout."))
|
||||
}
|
||||
|
|
18
hub.go
18
hub.go
|
@ -581,6 +581,24 @@ func (h *Hub) GetSessionByPublicId(sessionId string) Session {
|
|||
return session
|
||||
}
|
||||
|
||||
func (h *Hub) GetDialoutSession(roomId string, backend *Backend) *ClientSession {
|
||||
url := backend.Url()
|
||||
|
||||
h.mu.RLock()
|
||||
defer h.mu.RUnlock()
|
||||
for session := range h.dialoutSessions {
|
||||
if session.backend.Url() != url {
|
||||
continue
|
||||
}
|
||||
|
||||
if session.GetClient() != nil {
|
||||
return session
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Hub) checkExpiredSessions(now time.Time) {
|
||||
for s := range h.expiredSessions {
|
||||
if s.IsExpired(now) {
|
||||
|
|
Loading…
Reference in a new issue