mirror of
https://github.com/livekit/livekit.git
synced 2026-10-22 17:32:23 +00:00
back to MessageRouter interface
This commit is contained in:
1 parent
991c334d2d
commit
9aff9af690
1 file changed
+7
-5
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
type RTCService struct {
|
||||
router routing.Router
|
||||
router routing.MessageRouter
|
||||
roomAllocator RoomAllocator
|
||||
upgrader websocket.Upgrader
|
||||
currentNode routing.LocalNode
|
||||
@@ -29,7 +29,7 @@ type RTCService struct {
|
||||
limits config.LimitConfig
|
||||
}
|
||||
|
||||
func NewRTCService(conf *config.Config, ra RoomAllocator, router routing.Router, currentNode routing.LocalNode) *RTCService {
|
||||
func NewRTCService(conf *config.Config, ra RoomAllocator, router routing.MessageRouter, currentNode routing.LocalNode) *RTCService {
|
||||
s := &RTCService{
|
||||
router: router,
|
||||
roomAllocator: ra,
|
||||
@@ -77,9 +77,11 @@ func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit,
|
||||
roomName = onlyName
|
||||
}
|
||||
|
||||
if foundNode, err := s.router.GetNodeForRoom(r.Context(), roomName); err == nil {
|
||||
if selector.LimitsReached(s.limits, foundNode.Stats) {
|
||||
return "", routing.ParticipantInit{}, http.StatusServiceUnavailable, rtc.ErrLimitExceeded
|
||||
if router, ok := s.router.(routing.Router); ok {
|
||||
if foundNode, err := router.GetNodeForRoom(r.Context(), roomName); err == nil {
|
||||
if selector.LimitsReached(s.limits, foundNode.Stats) {
|
||||
return "", routing.ParticipantInit{}, http.StatusServiceUnavailable, rtc.ErrLimitExceeded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user