Detect disconnecton & handle error states in vrtsim

Add handling for error states in vrtsim which allows to close the
softmodems with CTRL+C without hanging, improving user experience
 - Client detection of stale timer.
 - Abort state for client and server
This commit is contained in:
Bartosz Podrygajlo
2025-08-20 15:57:34 +02:00
parent 16f5299203
commit fcea07ca71
4 changed files with 85 additions and 14 deletions
@@ -104,7 +104,7 @@ void server(void)
uint64_t timestamp = 0;
int iq_contents = 0;
while (timestamp < num_samples_per_update * num_updates) {
shm_td_iq_channel_wait(channel, timestamp + num_samples_per_update);
shm_td_iq_channel_wait(channel, timestamp + num_samples_per_update, 0);
uint64_t target_timestamp = timestamp + num_samples_per_update;
timestamp += num_samples_per_update;
uint32_t iq_data[num_samples_per_update];
@@ -141,7 +141,7 @@ int client(void)
int iq_contents = 0;
while (timestamp < num_samples_per_update * num_updates) {
shm_td_iq_channel_wait(channel, timestamp + num_samples_per_update);
shm_td_iq_channel_wait(channel, timestamp + num_samples_per_update, 0);
// Server starts producing from second slot
if (timestamp > num_samples_per_update) {
uint64_t target_timestamp = timestamp - num_samples_per_update;