[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:
@@ -183,11 +183,15 @@ async fn handle_connection(
|
||||
guard.replace(snapshot.spectrum);
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
// Backend may not support spectrum; clear buffer silently.
|
||||
Err(e) => {
|
||||
// A spectrum poll failure desynchronises the TCP stream
|
||||
// (the in-flight response is still in the buffer).
|
||||
// Propagate the error so the caller reconnects and
|
||||
// restores protocol sync.
|
||||
if let Ok(mut guard) = config.spectrum.lock() {
|
||||
guard.replace(None);
|
||||
}
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user