fix(deltacast-bridge): reset signal-wait deadline AFTER acquiring flock

The signal timeout deadline was set at process start before waiting for
the flock. Bridges queued behind earlier ports waited minutes for the
lock, then found their 30s signal deadline had already expired before
they even opened the board, causing false "no signal" failures on ports
that have live signal.

Fix: move clock_gettime deadline initialisation to AFTER flock acquired
and board opened, so the full sig_timeout is always available for signal
detection regardless of queue wait time.
This commit is contained in:
Zac Gaetano 2026-06-01 19:32:01 -04:00
parent 6979f07307
commit cad1e52c38

View file

@ -280,7 +280,11 @@ int main(int argc, char *argv[]) {
* (already bind-mounted into every capture sidecar) to guarantee only
* one bridge runs OpenBoardHandle + signal-wait at a time. The lock is
* released after signal lock succeeds (plus a settle delay) or on
* failure so the next bridge is never permanently blocked. */
* failure so the next bridge is never permanently blocked.
*
* IMPORTANT: the signal-wait deadline is set AFTER acquiring the lock so
* the full sig_timeout is available for signal detection regardless of
* how long this bridge waited in the queue. */
const char *lock_path = "/dev/shm/deltacast/bridge.lock";
int lock_fd = open(lock_path, O_CREAT | O_RDWR, 0666);
if (lock_fd >= 0) {
@ -313,7 +317,9 @@ int main(int argc, char *argv[]) {
VHD_SetBoardProperty(board, loopback_prop(port_id), FALSE);
}
/* ── Wait for signal lock ──────────────────────────────────────── */
/* ── Wait for signal lock ──────────────────────────────────────────
* Deadline is set HERE after the flock is acquired and the board is
* open so the full sig_timeout is available regardless of queue wait. */
ULONG video_std = (ULONG)NB_VHD_VIDEOSTANDARDS;
struct timespec deadline;
clock_gettime(CLOCK_MONOTONIC, &deadline);