From 0a1a08a1a56b498396f3a74a167ab7b600fc3571 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 7 Sep 2018 10:22:36 -0400 Subject: [PATCH] Added random delay to APRS packet submission --- APRSISClient.cpp | 6 ++++++ APRSISClient.h | 1 + 2 files changed, 7 insertions(+) diff --git a/APRSISClient.cpp b/APRSISClient.cpp index 7b43dbb..d0b587e 100644 --- a/APRSISClient.cpp +++ b/APRSISClient.cpp @@ -260,6 +260,12 @@ void APRSISClient::processQueue(bool disconnect){ auto frame = pair.first; auto timestamp = pair.second; + // random delay 50% of the time for throttling (a skip will add 60 seconds to the processing time) + if(qrand() % 100 <= 50){ + qDebug() << "APRSISClient Throttle: Skipping Frame"; + continue; + } + // if the packet is older than the timeout, drop it. if(timestamp.secsTo(QDateTime::currentDateTimeUtc()) > PACKET_TIMEOUT_SECONDS){ qDebug() << "APRSISClient Packet Timeout:" << frame; diff --git a/APRSISClient.h b/APRSISClient.h index 3e7a59e..bdad128 100644 --- a/APRSISClient.h +++ b/APRSISClient.h @@ -1,6 +1,7 @@ #ifndef APRSISCLIENT_H #define APRSISCLIENT_H +#include #include #include #include