From 9bcc16b94e53450adb615cdade81410d5635d096 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 6 Mar 2020 15:55:49 +0100 Subject: [PATCH] Ref T773, validate received network data again * ff no ICAO data are received, the model is not "ready for matching" * in that case we verify the situation and query ICAO data again * now we have to verify again, to see if the 2nd query suceeded (otherwise dangling) --- src/blackcore/airspacemonitor.cpp | 12 +++++++++++- src/blackcore/airspacemonitor.h | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index f192903f0..d0910878f 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -675,7 +675,7 @@ namespace BlackCore { static const QString readyForMatching("Ready (%1) for matching callsign '%2' with model type '%3', ICAO: '%4' '%5'"); - readiness.setFlag(ReadyForMatchingSent); // stored as readiness as reference + readiness.setFlag(ReadyForMatchingSent); // stored in readiness as reference const QString readyMsg = readyForMatching.arg(readiness.toQString(), callsign.toQString(), remoteAircraft.getModel().getModelTypeAsString(), remoteAircraft.getAircraftIcaoCode().getDesignatorDbKey(), remoteAircraft.getAirlineIcaoCode().getDesignatorDbKey()); const CStatusMessage m = CLogUtilities::logMessage(callsign, readyMsg, getLogCategories()); this->addReverseLookupMessage(callsign, m); @@ -711,6 +711,16 @@ namespace BlackCore { CLogMessage(this).info(u"Query ICAO codes for '%1' again") << callsign; this->sendInitialPilotQueries(callsign, true, true); + + // if the queries now yield a result all will be fine + // otherwise we need to check again + const QPointer myself(this); + QTimer::singleShot(MMVerifyMs, this, [ = ]() + { + // makes sure we have ICAO data + if (!myself || !sApp || sApp->isShuttingDown()) { return; } + this->verifyReceivedIcaoData(callsign); + }); return; } diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index 84680223c..0311a6894 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -282,9 +282,9 @@ namespace BlackCore BlackMisc::Aviation::CAtcStationList m_atcStationsOnline; //!< online ATC stations BlackMisc::Aviation::CAtcStationList m_atcStationsBooked; //!< booked ATC stations - QHash m_tempFsInnPackets; - QHash m_flightPlanCache; //!< flight plan information retrieved from network and cached - QHash m_readiness; //!< readiness + QHash m_tempFsInnPackets; //!< unhandled FsInn packets + QHash m_flightPlanCache; //!< flight plan information retrieved from network and cached + QHash m_readiness; //!< readiness BlackMisc::CSettingReadOnly m_matchingSettings { this }; //!< settings QQueue m_queryAtis; //!< query the ATIS QQueue m_queryPilot; //!< query the pilot data