Compare commits
No files matched your search
@@ -100,6 +100,12 @@ The wrapper downloads the pinned public-link sidecar, verifies its digest,
|
||||
builds the target App and available capture process, executes every packaged
|
||||
runtime from the extracted ZIP, and emits one `.zip` plus its SHA-256 file.
|
||||
|
||||
App ZIPs use ordinary Store/Deflate compression and relative entry names without
|
||||
`.` or `..` path segments; include hidden files and preserve executable modes on
|
||||
Unix. Windows packaging also checks every entry through Windows Explorer's ZIP
|
||||
reader. A successful extraction by the writer's own library does not establish
|
||||
compatibility with the user's default archive tool.
|
||||
|
||||
Retain the descriptor and successful deployment output as release metadata. Do
|
||||
not create a follow-up source commit solely to duplicate their revision, asset,
|
||||
or hashes.
|
||||
|
||||
@@ -114,6 +114,15 @@ publishing. The [release-source policy](../standards/versioning.md#release-sourc
|
||||
owns provenance, selection and quota limits. The first public release passed
|
||||
complete matching Server and three-platform App mirror download acceptance.
|
||||
|
||||
Release postflight applies the [two-version mirror retention policy](../standards/versioning.md#release-sources).
|
||||
After verifying the latest mirror and its fallback against GitHub, inventory
|
||||
older releases with `/releases/{id}/attach_files`, verify their GitHub originals,
|
||||
then remove only the reviewed attachments through
|
||||
`DELETE /releases/{id}/attach_files/{attachment_id}`. Recheck both retained
|
||||
versions and the anonymous `download/latest` links afterward. Keep deletion
|
||||
inventories and verification results with operator release records, not source
|
||||
history. The upload script does not itself delete older attachments.
|
||||
|
||||
## Platform References
|
||||
|
||||
- [Protected branch availability](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
|
||||
|
||||
@@ -92,6 +92,10 @@ fallback remains. It advances a silent Peer candidate instead of delaying the
|
||||
next available route; it is not interpreted as terminal ICE failure. The final
|
||||
or only Peer candidate remains until the unchanged total operation deadline.
|
||||
Transport-connected progress also retains a candidate through that deadline.
|
||||
Either exact preparing endpoint can report that progress, so a delayed Viewer
|
||||
confirmation does not discard a transport already observed by its parent.
|
||||
This cannot commit the route: first-frame readiness remains Viewer-owned, and
|
||||
progress never extends the total operation deadline.
|
||||
Consequently a working SFU route can carry media while its one-candidate direct
|
||||
convergence uses the full background operation, and peer-only acquisition does
|
||||
not abandon its only possible route at the foreground boundary.
|
||||
|
||||
@@ -271,8 +271,16 @@ an up-to-date result, does not consult the mirror.
|
||||
|
||||
Gitee currently documents 100 MB per attachment and 1 GB total repository
|
||||
attachments for ordinary projects. The mirror rejects files above 100,000,000
|
||||
bytes before writing. Check aggregate capacity before each release; exhausted
|
||||
storage leaves a pending preview rather than deleting older downloads.
|
||||
bytes before writing. GitHub retains published history; Gitee retains package
|
||||
attachments for the latest stable version and one preceding verified stable
|
||||
version. Order by semantic version, not update time; a preview cannot displace
|
||||
the fallback. Verify the new mirror completely before retiring older attachments,
|
||||
and verify that the fallback's packages remain downloadable and match GitHub.
|
||||
Delete only older mirror attachments with verified GitHub originals; retain
|
||||
release descriptions and tags. Unknown files or provenance require review.
|
||||
Check capacity before upload. Cleanup may reclaim versions outside the two
|
||||
retained stable versions; never delete either retained version to make an
|
||||
unverified replacement fit. Exhausted storage leaves a pending preview.
|
||||
Target authentication, uploads, anonymous metadata/CORS and the complete matching
|
||||
Server/three-platform App downloads and SHA-256 checks passed for the public release.
|
||||
Use API metadata in the Browser; ordinary asset-link redirects are not guaranteed
|
||||
|
||||
@@ -14,6 +14,13 @@ deployments remain separate. Physical limits are owned by
|
||||
|
||||
## Awaiting Device Or Reporter Evidence
|
||||
|
||||
- [ ] **Brief connection followed by repeated Viewer loss on v1.5.0.** One
|
||||
Viewer reportedly drops just after connection details appear, while other
|
||||
Viewers work; App public-link mode is suspected. Check signaling, first-frame
|
||||
admission and current-edge recovery separately. A delayed-confirmation
|
||||
reproduction establishes one premature candidate replacement; the affected
|
||||
environment and paired diagnostics are still unavailable, so the reporting
|
||||
machine's cause remains unconfirmed.
|
||||
- [ ] **App source-discovery field acceptance.** Retest the missing-window report
|
||||
with the current App and page. Obtain OS/browser, version and paired Debug
|
||||
reports to distinguish discovery, capture capability and enumeration failures.
|
||||
@@ -62,6 +69,9 @@ not establish better connection success or speed; this note adds no retry policy
|
||||
when directed, preserving the owner's platform deferrals. Correlate freezes
|
||||
with publisher/receiver evidence before changing media policy. Run physical
|
||||
workloads serially from stable executable paths with cleanup between runs.
|
||||
Before using the optional `viewer-mbb` benchmark canary, align its injected
|
||||
evidence and capacity assertions with the current sender-owned quality
|
||||
contract; its old Viewer-only trigger is not a valid quality acceptance gate.
|
||||
2. **Broader quality work.** Reopen from measured benefit at acceptable complexity.
|
||||
Preserve chosen profiles, bitrate ceilings, endpoint capacity and P2P-first
|
||||
routing unless a new accepted decision supports changing them. No weighted
|
||||
|
||||
@@ -732,10 +732,21 @@ func (r *router) handleRouteReady(participant authenticatedRouteParticipant, mes
|
||||
r.requestPump(participant.roomID)
|
||||
}
|
||||
|
||||
func (r *router) handleRouteTransportConnected(participant authenticatedRouteParticipant, message protocol.RouteTransportConnectedMessage) {
|
||||
if participant.role != protocol.RoleViewer {
|
||||
return
|
||||
// Either endpoint may report transport progress or local failure. First-frame
|
||||
// readiness remains owned by the candidate Viewer in handleRouteReady.
|
||||
func (r *router) ownsCandidateEndpoint(participant authenticatedRouteParticipant, operation *route.OperationSnapshot) bool {
|
||||
if participant.role == protocol.RoleViewer && participant.peerID == operation.ChildPeerID &&
|
||||
participant.sessionID == operation.ChildSessionID {
|
||||
return true
|
||||
}
|
||||
if operation.Current.Tuple.Kind == route.UpstreamPeer && participant.peerID == operation.Current.Tuple.ParentPeerID {
|
||||
peer, ok := r.connectedPeer(participant.roomID, participant.peerID)
|
||||
return ok && peer.SessionID == participant.sessionID
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *router) handleRouteTransportConnected(participant authenticatedRouteParticipant, message protocol.RouteTransportConnectedMessage) {
|
||||
rm, _ := r.rooms.Get(participant.roomID)
|
||||
if rm == nil || rm.controller == nil {
|
||||
return
|
||||
@@ -744,17 +755,16 @@ func (r *router) handleRouteTransportConnected(participant authenticatedRoutePar
|
||||
operation := controller.Operation()
|
||||
revision := int64(message.Revision)
|
||||
if operation == nil || operation.Current == nil ||
|
||||
operation.ChildPeerID != participant.peerID ||
|
||||
operation.ChildSessionID != participant.sessionID ||
|
||||
operation.Current.Revision != revision ||
|
||||
operation.Current.ConnectionID != message.ConnectionID ||
|
||||
operation.Current.Tuple.Kind != route.UpstreamPeer {
|
||||
operation.Current.Tuple.Kind != route.UpstreamPeer ||
|
||||
!r.ownsCandidateEndpoint(participant, operation) {
|
||||
return
|
||||
}
|
||||
before := controller.Revision()
|
||||
progressed := controller.CandidateTransportConnected(route.CandidateGuard{
|
||||
ChildPeerID: participant.peerID,
|
||||
ChildSessionID: participant.sessionID,
|
||||
ChildPeerID: operation.ChildPeerID,
|
||||
ChildSessionID: operation.ChildSessionID,
|
||||
Revision: revision,
|
||||
ConnectionID: message.ConnectionID,
|
||||
}, r.now())
|
||||
@@ -821,21 +831,14 @@ func (r *router) handleRouteFailed(participant authenticatedRouteParticipant, me
|
||||
return
|
||||
}
|
||||
current := operation.Current
|
||||
ownsChild := participant.role == protocol.RoleViewer &&
|
||||
participant.peerID == operation.ChildPeerID &&
|
||||
participant.sessionID == operation.ChildSessionID
|
||||
ownsParent := false
|
||||
if current.Tuple.Kind == route.UpstreamPeer && participant.peerID == current.Tuple.ParentPeerID {
|
||||
peer, ok := r.connectedPeer(participant.roomID, participant.peerID)
|
||||
ownsParent = ok && peer.SessionID == participant.sessionID
|
||||
}
|
||||
ownsEndpoint := r.ownsCandidateEndpoint(participant, operation)
|
||||
ownsPublication := false
|
||||
if current.Tuple.Kind == route.UpstreamSfu && participant.role == protocol.RoleHost &&
|
||||
participant.peerID == rm.hostPeerID {
|
||||
host, ok := r.store.GetConnectedHost(participant.roomID)
|
||||
ownsPublication = ok && host.SessionID == participant.sessionID
|
||||
}
|
||||
if !ownsChild && !ownsParent && !ownsPublication {
|
||||
if !ownsEndpoint && !ownsPublication {
|
||||
return
|
||||
}
|
||||
if connectionID != "" && connectionID != current.ConnectionID {
|
||||
|
||||
@@ -21,6 +21,7 @@ package signal
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"reflect"
|
||||
@@ -1515,6 +1516,73 @@ func TestRouterKeepsExactTransportConnectedDirectCandidatePastBoundary(t *testin
|
||||
})
|
||||
}
|
||||
|
||||
func TestRouterAcceptsExactParentProgressWithoutGrantingReadiness(t *testing.T) {
|
||||
for _, relayParent := range []bool{false, true} {
|
||||
t.Run(fmt.Sprintf("relay=%v", relayParent), func(t *testing.T) {
|
||||
h := newRouterHarness(t, routerHarnessOptions{capacity: 2, withSfu: true, prepareTimeoutMs: 300, fakeTimers: true})
|
||||
created := h.createRoom()
|
||||
host := h.connectHost(created, nil, "", "")
|
||||
h.locked(func() { h.doComplete(host) })
|
||||
parents := map[string]authenticatedRouteParticipant{host.peerID: host}
|
||||
if relayParent {
|
||||
for _, name := range []string{"root-a", "root-b"} {
|
||||
root := h.connectViewer(created, name)
|
||||
h.locked(func() { h.doComplete(root) })
|
||||
prepared := h.waitPreparedTransport(root.sessionID, "direct")
|
||||
h.routeReady(root, int64(prepared.Revision))
|
||||
h.locked(func() { h.doRelay(root, 2) })
|
||||
parents[root.peerID] = root
|
||||
}
|
||||
}
|
||||
viewer := h.connectViewer(created, "delayed-feedback")
|
||||
h.locked(func() { h.doComplete(viewer) })
|
||||
direct := h.waitPreparedTransport(viewer.sessionID, "direct")
|
||||
h.locked(func() {
|
||||
rm, _ := h.router.rooms.Get(created.RoomID)
|
||||
before := rm.controller.Operation()
|
||||
parent := parents[before.Current.Tuple.ParentPeerID]
|
||||
if (parent.role == protocol.RoleViewer) != relayParent {
|
||||
t.Fatal("unexpected preparing parent")
|
||||
}
|
||||
message := protocol.RouteTransportConnectedMessage{Type: "route-transport-connected", Revision: direct.Revision, ConnectionID: direct.Candidate.ConnectionID}
|
||||
stale := parent
|
||||
stale.sessionID = "retired-session"
|
||||
h.router.handleRouteTransportConnected(stale, message)
|
||||
foreign := parent
|
||||
foreign.peerID = "unrelated-peer"
|
||||
h.router.handleRouteTransportConnected(foreign, message)
|
||||
wrong := message
|
||||
wrong.ConnectionID = "retired-connection"
|
||||
h.router.handleRouteTransportConnected(parent, wrong)
|
||||
wrong = message
|
||||
wrong.Revision++
|
||||
h.router.handleRouteTransportConnected(parent, wrong)
|
||||
if rm.controller.Operation().WakeAtMs != before.WakeAtMs {
|
||||
t.Fatal("unrelated progress changed candidate timing")
|
||||
}
|
||||
h.router.handleRouteTransportConnected(parent, message)
|
||||
after := rm.controller.Operation()
|
||||
if after == nil || after.DeadlineAtMs != before.DeadlineAtMs || after.WakeAtMs != before.DeadlineAtMs {
|
||||
t.Fatal("parent progress did not retain the original total deadline")
|
||||
}
|
||||
h.doReady(parent, int64(direct.Revision))
|
||||
if rm.controller.Operation() == nil {
|
||||
t.Fatal("parent committed a route without Viewer readiness")
|
||||
}
|
||||
})
|
||||
h.clock.advance(150)
|
||||
if prepared, _ := h.preparedFor(viewer.sessionID); !reflect.DeepEqual(prepared, direct) {
|
||||
t.Fatal("connected candidate was replaced before delayed Viewer readiness")
|
||||
}
|
||||
h.routeReady(viewer, int64(direct.Revision))
|
||||
h.waitFor("the active peer edge", func() bool {
|
||||
active, ok := h.activeAfter(viewer.sessionID, int64(direct.Revision)-1)
|
||||
return ok && active.Assignment.Upstream.Kind == "peer"
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRouterUsesDirectBoundaryToBootstrapSfuWhenEveryHostSlotIsFull(t *testing.T) {
|
||||
h := newRouterHarness(t, routerHarnessOptions{capacity: 2, withSfu: true, prepareTimeoutMs: 300, fakeTimers: true})
|
||||
created := h.createRoom()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
export function tarExecutable() {
|
||||
@@ -15,10 +15,30 @@ export function createZip(source, archive) {
|
||||
if (process.platform === "linux") {
|
||||
execFileSync("zip", ["-qry", archive, "."], { cwd: source, stdio: "pipe" });
|
||||
} else {
|
||||
execFileSync(tarExecutable(), ["--format=zip", "-cf", archive, "."], {
|
||||
// Archiving "." adds ./ members that Windows Explorer treats as an empty ZIP.
|
||||
execFileSync(tarExecutable(), ["--format=zip", "-cf", archive, "--", ...readdirSync(source).sort()], {
|
||||
cwd: source, stdio: "pipe", windowsHide: true,
|
||||
});
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
// The writer can read its own incompatible ZIPs. Check Explorer separately,
|
||||
// including nested helpers and hidden files, before publishing the archive.
|
||||
execFileSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", `
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$shell = New-Object -ComObject Shell.Application
|
||||
function Check-Folder($folder, [string]$source) {
|
||||
if ($null -eq $folder) { throw 'Windows Explorer cannot open the ZIP folder' }
|
||||
foreach ($entry in Get-ChildItem -LiteralPath $source -Force) {
|
||||
$item = $folder.ParseName($entry.Name)
|
||||
if ($null -eq $item) { throw "Windows Explorer cannot read ZIP entry: $($entry.Name)" }
|
||||
if ($entry.PSIsContainer) { Check-Folder $item.GetFolder $entry.FullName }
|
||||
}
|
||||
}
|
||||
Check-Folder $shell.NameSpace($env:PIIK_ZIP_ARCHIVE) $env:PIIK_ZIP_SOURCE
|
||||
`], { stdio: "pipe", windowsHide: true, timeout: 30_000,
|
||||
env: { ...process.env, PIIK_ZIP_ARCHIVE: archive, PIIK_ZIP_SOURCE: resolve(source) },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function extractZip(archive, destination) {
|
||||
|
||||
@@ -153,7 +153,7 @@ interface FailurePageEvidence {
|
||||
connections: Array<{
|
||||
connectionState: string;
|
||||
iceConnectionState: string;
|
||||
identity: "peer" | "unidentified";
|
||||
identity: "peer" | "sfu" | "unidentified";
|
||||
hasOutboundVideo: boolean;
|
||||
hasInboundVideo: boolean;
|
||||
decoded: boolean;
|
||||
@@ -788,9 +788,9 @@ function sanitizeFailurePageEvidence(
|
||||
? connection.iceConnectionState
|
||||
: "unknown",
|
||||
identity:
|
||||
connection.connectionId !== null || connection.remotePeerId !== null
|
||||
connection.remotePeerId !== null
|
||||
? "peer"
|
||||
: "unidentified",
|
||||
: connection.connectionId !== null ? "sfu" : "unidentified",
|
||||
hasOutboundVideo: connection.hasOutboundVideo,
|
||||
hasInboundVideo: connection.hasInboundVideo,
|
||||
decoded: (connection.receiveTotals?.framesTotal ?? 0) > 0,
|
||||
@@ -850,7 +850,7 @@ function inspectSfuPublication(pages: readonly PageObservation[]) {
|
||||
? connection.sendTotals
|
||||
: connection.receiveTotals;
|
||||
return (
|
||||
connection.connectionId === null &&
|
||||
connection.connectionId !== null &&
|
||||
connection.remotePeerId === null &&
|
||||
connection.connectionState === "connected" &&
|
||||
(direction === "send"
|
||||
@@ -1170,7 +1170,7 @@ function committedReceiveMetrics(
|
||||
connection.receive !== null &&
|
||||
(upstream.kind === "peer"
|
||||
? connection.remotePeerId === upstream.peerId
|
||||
: connection.connectionId === null && connection.remotePeerId === null),
|
||||
: connection.connectionId !== null && connection.remotePeerId === null),
|
||||
);
|
||||
return matching.length === 1 ? matching[0]!.receive : null;
|
||||
}
|
||||
@@ -1825,7 +1825,7 @@ function buildBenchmarkInitScript(options: {
|
||||
}
|
||||
|
||||
function recordDescription(message, direction) {
|
||||
const payload = message && message.payload;
|
||||
const payload = message.type === "sfu-signal" ? message : message.payload;
|
||||
if (!payload || payload.kind !== "description" || !payload.description) return;
|
||||
descriptions.push({
|
||||
peerId: direction === "out" ? message.targetPeerId : message.fromPeerId,
|
||||
@@ -1833,6 +1833,7 @@ function buildBenchmarkInitScript(options: {
|
||||
sdpKey: sdpKey(payload.description.sdp),
|
||||
});
|
||||
if (descriptions.length > 128) descriptions.shift();
|
||||
recordActiveOutboundEdges();
|
||||
}
|
||||
|
||||
function sanitizeRouteTimingSamples(value) {
|
||||
@@ -1912,7 +1913,7 @@ function buildBenchmarkInitScript(options: {
|
||||
) {
|
||||
routeTimingSamples = sanitizeRouteTimingSamples(message.snapshot);
|
||||
}
|
||||
if (message.type === "signal") recordDescription(message, direction);
|
||||
if (message.type === "signal" || message.type === "sfu-signal") recordDescription(message, direction);
|
||||
}
|
||||
|
||||
const NativeWebSocket = globalThis.WebSocket;
|
||||
@@ -1974,7 +1975,7 @@ function buildBenchmarkInitScript(options: {
|
||||
|
||||
const NativePeerConnection = globalThis.RTCPeerConnection;
|
||||
function recordActiveOutboundEdges() {
|
||||
const active = connections.filter(({ connection }) =>
|
||||
const active = networkConnections().filter(({ connection }) =>
|
||||
connection.connectionState !== "closed" &&
|
||||
connection.connectionState !== "failed" &&
|
||||
connection.getSenders().some((sender) => sender.track && sender.track.kind === "video")
|
||||
@@ -2084,6 +2085,12 @@ function buildBenchmarkInitScript(options: {
|
||||
return { connectionId: null, remotePeerId: null };
|
||||
}
|
||||
|
||||
// Local codec probes and encoding-pool transports never cross room signaling.
|
||||
// Count actual Peer/SFU media edges, not every RTCPeerConnection in the page.
|
||||
function networkConnections() {
|
||||
return connections.filter(({ connection }) => identify(connection).connectionId !== null);
|
||||
}
|
||||
|
||||
function totals(report, type) {
|
||||
let selected = null;
|
||||
report.forEach((raw) => {
|
||||
@@ -2162,13 +2169,13 @@ function buildBenchmarkInitScript(options: {
|
||||
}
|
||||
|
||||
async function sample() {
|
||||
const sampledConnections = await Promise.all(connections.map(connectionSample));
|
||||
const sampledConnections = await Promise.all(networkConnections().map(connectionSample));
|
||||
return { ...baseSnapshot(), connections: sampledConnections };
|
||||
}
|
||||
|
||||
async function progress() {
|
||||
const values = [];
|
||||
for (const record of connections) {
|
||||
for (const record of networkConnections()) {
|
||||
const connection = record.connection;
|
||||
const hasOutboundVideo = connection.getSenders().some((sender) => sender.track && sender.track.kind === "video");
|
||||
const hasInboundVideo = connection.getReceivers().some((receiver) => receiver.track && receiver.track.kind === "video");
|
||||
@@ -2195,7 +2202,7 @@ function buildBenchmarkInitScript(options: {
|
||||
function snapshot() {
|
||||
return {
|
||||
...baseSnapshot(),
|
||||
connections: connections.map((record) => ({
|
||||
connections: networkConnections().map((record) => ({
|
||||
index: record.index,
|
||||
...identify(record.connection),
|
||||
connectionState: record.connection.connectionState,
|
||||
|
||||
@@ -47,6 +47,7 @@ interface HostProvisionalChildEvents {
|
||||
) => void;
|
||||
onPromotedUpdate?: (peer: HostMediaPeer, snapshot: PeerSnapshot) => void;
|
||||
onPreparedChildFailed?: (revision: number, connectionId: string) => void;
|
||||
onPreparedChildConnected?: (revision: number, connectionId: string) => boolean;
|
||||
}
|
||||
|
||||
export type HostPreparedChildActivation =
|
||||
@@ -58,6 +59,7 @@ interface PreparedHostChild {
|
||||
candidate: PreparedRouteCandidate;
|
||||
peer: HostMediaPeer;
|
||||
failed: boolean;
|
||||
connectedSent: boolean;
|
||||
replacesConnectionId: string | null;
|
||||
}
|
||||
|
||||
@@ -119,6 +121,17 @@ export class HostProvisionalChild {
|
||||
: false,
|
||||
onUpdate: (snapshot: PeerSnapshot) => {
|
||||
if (this.prepared?.peer === peer) {
|
||||
const prepared = this.prepared;
|
||||
if (
|
||||
!prepared.failed && !prepared.connectedSent &&
|
||||
snapshot.connectionState === "connected" &&
|
||||
snapshot.connectionId === candidate.connectionId &&
|
||||
snapshot.peerId === candidate.childPeerId
|
||||
) {
|
||||
prepared.connectedSent = this.events.onPreparedChildConnected?.(
|
||||
revision, candidate.connectionId,
|
||||
) ?? false;
|
||||
}
|
||||
if (snapshot.connectionState === "failed") {
|
||||
this.fail(peer);
|
||||
}
|
||||
@@ -150,6 +163,7 @@ export class HostProvisionalChild {
|
||||
candidate: { ...candidate },
|
||||
peer,
|
||||
failed: false,
|
||||
connectedSent: false,
|
||||
replacesConnectionId:
|
||||
this.events.activeConnectionId?.(candidate.childPeerId) ?? null,
|
||||
};
|
||||
|
||||
@@ -1901,6 +1901,9 @@ export function HostPage({
|
||||
onPreparedChildFailed: (revision, connectionId) => {
|
||||
reportPreparedHostChildFailure(revision, connectionId, generation);
|
||||
},
|
||||
onPreparedChildConnected: (revision, connectionId) =>
|
||||
isCurrentGeneration(generation) && signalRef.current === signal &&
|
||||
signal.send({ type: "route-transport-connected", revision, connectionId }),
|
||||
createPeer:
|
||||
nativeClient && nativeShareGeneration
|
||||
? (candidate, input, events) => {
|
||||
|
||||
@@ -843,6 +843,8 @@ export function ViewerPage({
|
||||
}
|
||||
},
|
||||
onPreparedChildFailed: reportPreparedChildFailure,
|
||||
onPreparedChildConnected: (revision, connectionId) =>
|
||||
active && signal.send({ type: "route-transport-connected", revision, connectionId }),
|
||||
},
|
||||
endpointMediaCopyCapacity,
|
||||
currentRoutePolicy.natPrediction,
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface ViewerRelayEvents {
|
||||
onUpdate?: (snapshot: PeerSnapshot | null) => void;
|
||||
onSenderUpdate?: (snapshot: PeerSnapshot, revision: number | null) => void;
|
||||
onPreparedChildFailed?: (revision: number, connectionId: string) => void;
|
||||
onPreparedChildConnected?: (revision: number, connectionId: string) => boolean;
|
||||
}
|
||||
interface PreparedChild {
|
||||
revision: number;
|
||||
@@ -32,6 +33,7 @@ interface PreparedChild {
|
||||
candidate: PreparedRouteCandidate;
|
||||
peer: HostMediaPeer;
|
||||
failed: boolean;
|
||||
connectedSent: boolean;
|
||||
replacesConnectionId: string | null;
|
||||
}
|
||||
|
||||
@@ -376,6 +378,7 @@ export class ViewerRelay {
|
||||
candidate: { ...candidate },
|
||||
peer,
|
||||
failed: false,
|
||||
connectedSent: false,
|
||||
replacesConnectionId:
|
||||
this.peers.get(candidate.childPeerId)?.connectionId ?? null,
|
||||
};
|
||||
@@ -539,6 +542,17 @@ export class ViewerRelay {
|
||||
: false,
|
||||
onUpdate: (snapshot) => {
|
||||
if (this.preparedChild?.peer === peer) {
|
||||
const prepared = this.preparedChild;
|
||||
if (
|
||||
!prepared.failed && !prepared.connectedSent &&
|
||||
snapshot.connectionState === "connected" &&
|
||||
snapshot.connectionId === prepared.candidate.connectionId &&
|
||||
snapshot.peerId === prepared.childPeerId
|
||||
) {
|
||||
prepared.connectedSent = this.events.onPreparedChildConnected?.(
|
||||
prepared.revision, snapshot.connectionId,
|
||||
) ?? false;
|
||||
}
|
||||
if (snapshot.connectionState === "failed") {
|
||||
this.failPreparedChild(peer);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createZip, extractZip } from "../scripts/archive-tool.mjs";
|
||||
import { createZip, extractZip, tarExecutable } from "../scripts/archive-tool.mjs";
|
||||
|
||||
describe("App ZIP distribution", () => {
|
||||
it("round-trips hidden files, spaced paths and executable permissions", () => {
|
||||
@@ -28,6 +28,11 @@ describe("App ZIP distribution", () => {
|
||||
for (const name of executables) chmodSync(join(source, name), 0o755);
|
||||
createZip(source, archive);
|
||||
expect(readFileSync(archive).subarray(0, 4)).toEqual(Buffer.from([0x50, 0x4b, 0x03, 0x04]));
|
||||
const entries = execFileSync(process.platform === "linux" ? "unzip" : tarExecutable(),
|
||||
process.platform === "linux" ? ["-Z", "-1", archive] : ["-tf", archive],
|
||||
{ encoding: "utf8", windowsHide: true }).trim().split(/\r?\n/);
|
||||
expect(entries).toHaveLength(readdirSync(source, { recursive: true }).length);
|
||||
for (const name of entries) expect(name).not.toMatch(/(^|\/)\.\.?($|\/)/);
|
||||
mkdirSync(extracted);
|
||||
extractZip(archive, extracted);
|
||||
expect(readdirSync(extracted, { recursive: true }).sort()).toEqual(
|
||||
|
||||
@@ -1763,6 +1763,30 @@ function hostProvisionalInput(
|
||||
}
|
||||
|
||||
describe("Host provisional child runtime ownership", () => {
|
||||
it("reports connected preparation once, retries unsent progress and fences replacement", async () => {
|
||||
const progress = vi.fn().mockReturnValueOnce(false).mockReturnValue(true);
|
||||
const owner = new HostProvisionalChild({ sendSignal: () => true, onPreparedChildConnected: progress });
|
||||
const stream = createStream(createTrack("video", "progress-video"), null);
|
||||
owner.prepare(hostProvisionalInput(7, ["child"], stream));
|
||||
const first = FakePeerConnection.latest!;
|
||||
first.connectionState = "connected";
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(2);
|
||||
expect(progress).toHaveBeenLastCalledWith(7, "candidate-connection-7");
|
||||
owner.prepare(hostProvisionalInput(8, ["replacement"], stream));
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(2);
|
||||
const second = FakePeerConnection.latest!;
|
||||
second.connectionState = "connected";
|
||||
second.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenLastCalledWith(8, "candidate-connection-8");
|
||||
owner.discard();
|
||||
second.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it("accepts only the exact connection and promotes the same peer", async () => {
|
||||
const signals: Array<{ peerId: string; connectionId: string }> = [];
|
||||
const promotedUpdates = vi.fn();
|
||||
@@ -2313,6 +2337,34 @@ describe("ViewerRelay downstream ownership", () => {
|
||||
expect(onPreparedChildFailed).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("reports relay transport progress once and retires its reporting scope", async () => {
|
||||
const progress = vi.fn().mockReturnValueOnce(false).mockReturnValue(true);
|
||||
const relay = new ViewerRelay(
|
||||
{ iceServers: [] }, QUALITY_PROFILES["720p30"],
|
||||
{ sendSignal: () => true, onPreparedChildConnected: progress },
|
||||
);
|
||||
relay.setStream(createStream(createTrack("video", "relay-progress"), null));
|
||||
relay.prepareChild(7, routeCandidate(7, "child"), ["child"]);
|
||||
await vi.waitFor(() => expect(FakePeerConnection.latest).not.toBeNull());
|
||||
const first = FakePeerConnection.latest!;
|
||||
first.connectionState = "connected";
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(2);
|
||||
expect(progress).toHaveBeenLastCalledWith(7, "relay-candidate-7");
|
||||
relay.prepareChild(8, routeCandidate(8, "replacement"), ["replacement"]);
|
||||
first.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(2);
|
||||
const second = FakePeerConnection.latest!;
|
||||
second.connectionState = "connected";
|
||||
second.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenLastCalledWith(8, "relay-candidate-8");
|
||||
relay.dispose();
|
||||
second.dispatchEvent(new Event("connectionstatechange"));
|
||||
expect(progress).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it("reports a failed prepared transport once without blaming retained children", async () => {
|
||||
const onPreparedChildFailed = vi.fn();
|
||||
const relay = new ViewerRelay(
|
||||
|
||||
Reference in new issue
Block a user