Prevent stale monitor start requests from retuning audio

This commit is contained in:
Smittix
2026-02-23 23:56:21 +00:00
parent 2af238aed5
commit 975a95e1b0
2 changed files with 213 additions and 186 deletions

View File

@@ -2704,6 +2704,7 @@ const Waterfall = (function () {
gain,
device,
biasT,
requestToken,
}) {
const response = await fetch('/receiver/audio/start', {
method: 'POST',
@@ -2716,6 +2717,7 @@ const Waterfall = (function () {
device: device.deviceIndex,
sdr_type: device.sdrType,
bias_t: biasT,
request_token: requestToken,
}),
});
@@ -2812,10 +2814,13 @@ const Waterfall = (function () {
gain,
device: monitorDevice,
biasT,
requestToken: nonce,
});
if (nonce !== _audioConnectNonce) return;
const busy = payload?.error_type === 'DEVICE_BUSY' || response.status === 409;
const staleStart = payload?.superseded === true || payload?.status === 'stale';
if (staleStart) return;
const busy = payload?.error_type === 'DEVICE_BUSY' || (response.status === 409 && !staleStart);
if (
busy
&& _running
@@ -2834,8 +2839,10 @@ const Waterfall = (function () {
gain,
device: monitorDevice,
biasT,
requestToken: nonce,
}));
if (nonce !== _audioConnectNonce) return;
if (payload?.superseded === true || payload?.status === 'stale') return;
}
if (!response.ok || payload.status !== 'started') {