Ensure we don't publish to any transport until our own transport is ok

This commit is contained in:
Valere
2026-04-10 09:24:34 +02:00
parent 40dacd523b
commit aea5815dab
2 changed files with 73 additions and 2 deletions
@@ -232,7 +232,16 @@ export const createLocalMembership$ = ({
// Unwrap the local transport and set the state of the LocalMembership to error in case the transport is an error.
const activeTransport$ = scope.behavior(
localTransport$.pipe(
switchMap((lt) => lt.active$.pipe(map((t) => t?.transport ?? null))),
switchMap((lt) => {
return combineLatest([lt.active$, lt.advertised$]).pipe(
map(([active, advertised]) => {
// Our policy is to not publish to another transport if our prefered transport is miss-configured
if (advertised == null) return null;
return active?.transport ?? null;
}),
);
}),
catchError(handleTransportError),
distinctUntilChanged(areLivekitTransportsEqual),
),