fixed multi-node routing, correctly set rtc and signal nodes
This commit is contained in:
@@ -150,12 +150,6 @@ func (r *RoomManager) StartSession(roomName, participantId, participantName stri
|
||||
return
|
||||
}
|
||||
|
||||
// register participant to be on this server
|
||||
if err = r.router.SetParticipantRTCNode(participantId, r.currentNode.Id); err != nil {
|
||||
logger.Errorw("could not set RTC node", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
// join room
|
||||
if err := room.Join(participant); err != nil {
|
||||
logger.Errorw("could not join room", "error", err)
|
||||
|
||||
@@ -71,7 +71,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
participantId := utils.NewGuid(utils.ParticipantPrefix)
|
||||
err = s.router.StartParticipant(roomName, participantId, pName)
|
||||
err = s.router.StartParticipantSignal(roomName, participantId, pName)
|
||||
if err != nil {
|
||||
handleError(w, http.StatusInternalServerError, "could not start session: "+err.Error())
|
||||
return
|
||||
@@ -109,6 +109,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
"room", rm.Sid,
|
||||
"roomName", rm.Name,
|
||||
"name", pName,
|
||||
"resSource", fmt.Sprintf("%p", resSource),
|
||||
)
|
||||
|
||||
// handle responses
|
||||
|
||||
@@ -62,7 +62,7 @@ func NewLivekitServer(conf *config.Config,
|
||||
}
|
||||
|
||||
// hook up router to the RoomManager
|
||||
router.OnNewParticipant(roomManager.StartSession)
|
||||
router.OnNewParticipantRTC(roomManager.StartSession)
|
||||
|
||||
// clean up old rooms on startup
|
||||
err = roomManager.Cleanup()
|
||||
|
||||
Reference in New Issue
Block a user