Close websocket connection upon join failure (#458)

* Close websocket connection on join failure to avoid hang

* fix auto creation bug
This commit is contained in:
David Zhao
2022-02-22 17:43:25 -08:00
committed by GitHub
parent 3e7fae96ea
commit 7eb2fecadd
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -260,6 +260,7 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
}
if err = room.Join(participant, &opts, r.iceServersForRoom(room.Room)); err != nil {
pLogger.Errorw("could not join room", err)
_ = participant.Close(true)
return
}
if err = r.roomStore.StoreParticipant(ctx, roomName, participant.ToProto()); err != nil {
+2
View File
@@ -151,8 +151,10 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
_, err := s.store.LoadRoom(context.Background(), roomName)
if err == ErrRoomNotFound {
handleError(w, 404, err.Error())
return
} else if err != nil {
handleError(w, 500, err.Error())
return
}
}