From b4f5be063311dfd086ed152f3ceb27cdc902e86c Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sat, 23 Feb 2019 07:40:10 -0700 Subject: [PATCH] skip packets that aren't in sequence --- QnetGateway.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 877366f..c7d6ec4 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -1138,8 +1138,13 @@ void CQnetGateway::ProcessG2(const ssize_t g2buflen, const SDSVT &g2buf, const b } } - lastctrl = (0x3FU & g2buf.ctrl); - Gate2Modem[i].Write(g2buf.title, 27); + if ((lastctrl + 1U) % 21U == (0x3FU & g2buf.ctrl)) { + lastctrl = (0x3FU & g2buf.ctrl); + Gate2Modem[i].Write(g2buf.title, 27); + } else { + if (LOG_DEBUG) + fprintf(stderr, "Warning: Ignoring packet because its ctrl=0x%02uU and lastctrl=0x%02uU\n", g2buf.ctrl, lastctrl); + } /* timeit */ time(&toRptr[i].last_time);