use request context in rtc service

This commit is contained in:
David Colburn
2021-08-30 23:27:04 -07:00
parent d882542491
commit eb6e763e8d
+2 -3
View File
@@ -1,7 +1,6 @@
package service
import (
"context"
"fmt"
"io"
"net/http"
@@ -109,14 +108,14 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// create room if it doesn't exist, also assigns an RTC node for the room
rm, err := s.roomManager.CreateRoom(context.Background(), &livekit.CreateRoomRequest{Name: roomName})
rm, err := s.roomManager.CreateRoom(r.Context(), &livekit.CreateRoomRequest{Name: roomName})
if err != nil {
handleError(w, http.StatusInternalServerError, err.Error())
return
}
// this needs to be started first *before* using router functions on this node
connId, reqSink, resSource, err := s.router.StartParticipantSignal(context.Background(), roomName, pi)
connId, reqSink, resSource, err := s.router.StartParticipantSignal(r.Context(), roomName, pi)
if err != nil {
handleError(w, http.StatusInternalServerError, "could not start session: "+err.Error())
return