Ref T706, staggered queires for ATC and aircraft

* avoid overlapping responses: https://discordapp.com/channels/539048679160676382/539925070550794240/603176348445442058
* potential: avoid traffic overload (forcible logoff)
This commit is contained in:
Klaus Basan
2019-07-23 18:25:06 +02:00
committed by Mat Sutcliffe
parent f40dbb6c81
commit 82812e6630
2 changed files with 74 additions and 7 deletions

View File

@@ -45,6 +45,7 @@
#include <QString>
#include <QTimer>
#include <QtGlobal>
#include <QQueue>
#include <functional>
namespace BlackCore
@@ -253,10 +254,16 @@ namespace BlackCore
QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CFlightPlan> m_flightPlanCache; //!< flight plan information retrieved from network and cached
QHash<BlackMisc::Aviation::CCallsign, Readiness> m_readiness; //!< readiness
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< settings
QQueue<BlackMisc::Aviation::CCallsign> m_queryAtis; //!< query the ATIS
QQueue<BlackMisc::Aviation::CCallsign> m_queryPilot; //!< query the pilot data
INetwork *m_network = nullptr; //!< corresponding network interface
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
QTimer m_processTimer;
static constexpr int ProcessInterval = 50; // in ms
//! Processing by timer
void process();
//! Remove ATC online stations
void removeAllOnlineAtcStations();
@@ -272,9 +279,15 @@ namespace BlackCore
//! Network queries for ATC
void sendInitialAtcQueries(const BlackMisc::Aviation::CCallsign &callsign);
//! Network queries for ATIS
bool sendNextStaggeredAtisQuery();
//! Network queries for pilots
void sendInitialPilotQueries(const BlackMisc::Aviation::CCallsign &callsign, bool withIcaoQuery, bool withFsInn);
//! Network queries for pilot
bool sendNextStaggeredPilotDataQuery();
//! Connected with network?
bool isConnected() const;