Close previous request channels when during initial retry (#1409)

So we don't leave abandoned requests hanging on the media instance
This commit is contained in:
David Zhao
2023-02-09 17:27:33 -08:00
committed by GitHub
parent aebec26ace
commit 9a7ea7a2fa
5 changed files with 143 additions and 0 deletions
+3
View File
@@ -458,6 +458,9 @@ func (s *RTCService) startConnection(ctx context.Context, roomName livekit.RoomN
// instead of waiting forever on the WebSocket
cr.InitialResponse, err = readInitialResponse(cr.ResponseSource, timeout)
if err != nil {
// close the connection to avoid leaking
cr.RequestSink.Close()
cr.ResponseSource.Close()
return cr, err
}
return cr, nil