don't read from the queue unless is_alive

pull/14/head
Tom Early 6 years ago
parent 30f732a5d0
commit fd5e77b5fc

@ -358,6 +358,7 @@ void CQnetITAP::Run(const char *cfgfile)
// send queued frames
if (keep_running) {
if (acknowledged) {
if (is_alive) {
if (! queue.empty()) {
CFrame frame = queue.front();
queue.pop();
@ -365,6 +366,14 @@ void CQnetITAP::Run(const char *cfgfile)
ackTimer.start();
acknowledged = false;
}
}else {
static std::size_t last_count = 0;
std::size_t count = queue.size();
if (last_count != count) {
printf("queue contains %lu packets\n", count);
last_count = count;
}
}
} else { // we are waiting on an acknowledgement
if (ackTimer.time() >= 0.06) {
fprintf(stderr, "ERROR: packet sent to serial port not acknowledged\n");
@ -376,12 +385,16 @@ void CQnetITAP::Run(const char *cfgfile)
lastdataTimer.start();
pingTimer.start();
serfd = OpenITAP();
if (serfd < 0)
if (serfd < 0) {
keep_running = false;
} else {
while (! queue.empty())
queue.pop();
}
}
}
}
}
}
close(serfd);
Gate2Modem.Close();
@ -611,7 +624,7 @@ bool CQnetITAP::ReadConfig(const char *cfgFile)
}
cfg.GetValue("log_qso", estr, log_qso);
log_qso = false;
return false;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.