don't read from the queue unless is_alive

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

@ -358,12 +358,21 @@ void CQnetITAP::Run(const char *cfgfile)
// send queued frames // send queued frames
if (keep_running) { if (keep_running) {
if (acknowledged) { if (acknowledged) {
if (! queue.empty()) { if (is_alive) {
CFrame frame = queue.front(); if (! queue.empty()) {
queue.pop(); CFrame frame = queue.front();
SendTo(frame.data()); queue.pop();
ackTimer.start(); SendTo(frame.data());
acknowledged = false; 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 } else { // we are waiting on an acknowledgement
if (ackTimer.time() >= 0.06) { if (ackTimer.time() >= 0.06) {
@ -376,12 +385,16 @@ void CQnetITAP::Run(const char *cfgfile)
lastdataTimer.start(); lastdataTimer.start();
pingTimer.start(); pingTimer.start();
serfd = OpenITAP(); serfd = OpenITAP();
if (serfd < 0) if (serfd < 0) {
keep_running = false; keep_running = false;
} else {
while (! queue.empty())
queue.pop();
}
} }
} }
} }
} }
close(serfd); close(serfd);
Gate2Modem.Close(); Gate2Modem.Close();
@ -611,7 +624,7 @@ bool CQnetITAP::ReadConfig(const char *cfgFile)
} }
cfg.GetValue("log_qso", estr, log_qso); cfg.GetValue("log_qso", estr, log_qso);
log_qso = false;
return false; return false;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.