From d5808f96df66d97703bed9657fd642d5fb5d1478 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 31 Aug 2023 09:39:45 -0700 Subject: [PATCH] Disconnect participant when signal proxy is closed (#2024) When signal proxy is closed, we'd want to stop writing to it and sever WS connection with the client. Client would go into a reconnect sequence --- pkg/service/rtcservice.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/service/rtcservice.go b/pkg/service/rtcservice.go index f469cda2d..ab49ba24a 100644 --- a/pkg/service/rtcservice.go +++ b/pkg/service/rtcservice.go @@ -34,6 +34,7 @@ import ( "github.com/livekit/livekit-server/pkg/utils" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" + "github.com/livekit/psrpc" "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/routing" @@ -418,6 +419,10 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) { if err := cr.RequestSink.WriteMessage(req); err != nil { pLogger.Warnw("error writing to request sink", err, "connID", cr.ConnectionID) + if errors.Is(err, psrpc.ErrStreamClosed) { + // disconnect the participant WS since the signal proxy has been broken + return + } } } }