Added random delay to APRS packet submission

This commit is contained in:
Jordan Sherer 2018-09-07 10:22:36 -04:00
parent 775008be48
commit 0a1a08a1a5
2 changed files with 7 additions and 0 deletions

View File

@ -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;

View File

@ -1,6 +1,7 @@
#ifndef APRSISCLIENT_H
#define APRSISCLIENT_H
#include <QtGlobal>
#include <QDateTime>
#include <QTcpSocket>
#include <QQueue>