mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 14:50:00 -07:00
fix: resolve meteor WebSocket race condition and setup apt-get failure
Meteor: onopen callback used closure variable _ws instead of `this`, so a double-click during CONNECTING state sent on the wrong socket. Also clean up any in-progress connection on re-start, not just running ones. Setup: make apt-get update non-fatal so third-party repo errors (e.g. stale PPAs on Debian) don't abort the entire install. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,7 +88,7 @@ const MeteorScatter = (function () {
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (_running) stop();
|
||||
if (_running || _ws) stop();
|
||||
|
||||
const freq = parseFloat(document.getElementById('meteorFrequency')?.value) || 143.05;
|
||||
const gain = parseFloat(document.getElementById('meteorGain')?.value) || 0;
|
||||
@@ -126,9 +126,13 @@ const MeteorScatter = (function () {
|
||||
}
|
||||
|
||||
_ws.onopen = function () {
|
||||
// Guard against race: if start() was called again before this
|
||||
// connection opened, _ws now points to a different socket.
|
||||
if (_ws !== this) { try { this.close(); } catch (e) { /* */ } return; }
|
||||
|
||||
_running = true;
|
||||
_updateUI();
|
||||
_ws.send(JSON.stringify({
|
||||
this.send(JSON.stringify({
|
||||
cmd: 'start',
|
||||
frequency_mhz: freq,
|
||||
gain: gain === 0 ? 'auto' : gain,
|
||||
|
||||
Reference in New Issue
Block a user