[fix](trx-client,trx-server): fix spectrum death and stuck shutdown after IQ overflow
Two bugs triggered by a SoapySDR IQ overflow: 1. Spectrum dies permanently (trx-client): when GetSpectrum times out (300ms SPECTRUM_IO_TIMEOUT), the error was silently swallowed and the spectrum buffer cleared. The in-flight response remained in the TCP receive buffer, desynchronising all subsequent reads so every poll kept failing. Fix: propagate the error so handle_connection returns and the outer loop reconnects, restoring TCP sync. 2. CTRL+C hangs trx-server: after IQ overflow, the sdr-iq-read thread can get stuck in a blocking SoapySDR/USB call (deactivate/activate with no timeout). Tokio received SIGINT and aborted async tasks, but the process could not exit while the native thread was blocked in uninterruptible I/O. Fix: call std::process::exit(0) after the graceful shutdown sequence so the OS forcibly terminates all threads. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -1017,5 +1017,7 @@ async fn main() -> DynResult<()> {
|
||||
for handle in task_handles {
|
||||
let _ = handle.await;
|
||||
}
|
||||
Ok(())
|
||||
// Force exit so that native threads stuck in blocking hardware I/O
|
||||
// (e.g. SoapySDR/USB transfers in D-state) cannot prevent shutdown.
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user