From 6a334c61df09a1e623ba28d69f772958c9b36adf Mon Sep 17 00:00:00 2001 From: Smittix Date: Mon, 2 Mar 2026 21:48:56 +0000 Subject: [PATCH] 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 --- setup.sh | 5 ++++- static/js/modes/meteor.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 66be41c..cc9185b 100755 --- a/setup.sh +++ b/setup.sh @@ -1370,7 +1370,10 @@ install_debian_packages() { CURRENT_STEP=0 progress "Updating APT package lists" - $SUDO apt-get update -y >/dev/null + if ! $SUDO apt-get update -y >/dev/null 2>&1; then + warn "apt-get update reported errors (possibly from third-party repos on your system)." + warn "Continuing anyway — if package installs fail, check your APT sources." + fi progress "Installing RTL-SDR" if ! $IS_DRAGONOS; then diff --git a/static/js/modes/meteor.js b/static/js/modes/meteor.js index 933205d..bb620a5 100644 --- a/static/js/modes/meteor.js +++ b/static/js/modes/meteor.js @@ -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,