[AFV] Signal/handling for authentication failures

* authentication issues in AFV were silently handled
* and there was no re-try, which could mean an initial glitch COULD cause AFV not working properly
* NOW handling in AFV client and context
* also reset connection data so for a new session no old authentication token or check time is used
* check for "invalid" QDateTime(s)
This commit is contained in:
Klaus Basan
2020-04-27 19:04:01 +02:00
committed by Mat Sutcliffe
parent 9e6716e515
commit bba07ef4c4
13 changed files with 146 additions and 34 deletions

View File

@@ -293,6 +293,9 @@ namespace BlackCore
//! Connection status has been changed
void connectionStatusChanged(ConnectionStatus status);
//! Authentication has failed with AFV server
void afvConnectionFailure(const BlackMisc::CStatusMessage &msg);
//! Client updated from own aicraft data
void updatedFromOwnAircraftCockpit();
@@ -332,6 +335,12 @@ namespace BlackCore
void onUpdateTransceiversFromContext(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
void onReceivingCallsignsChanged(const BlackCore::Afv::Audio::TransceiverReceivingCallsignsChangedArgs &args);
//! Re-try connection to server
void retryConnectTo(const QString &cid, const QString &password, const QString &callsign, const QString &client, const QString &reason);
//! Connect again in given ms
void reconnectTo(const QString &cid, const QString &password, const QString &callsign, const QString &client, int delayMs, const BlackMisc::CStatusMessage &msg);
//! All aliased stations
//! \threadsafe
//! @{
@@ -375,7 +384,8 @@ namespace BlackCore
QSet<quint16> m_enabledTransceivers;
static const QVector<quint16> &allTransceiverIds() { static const QVector<quint16> transceiverIds{0, 1}; return transceiverIds; }
std::atomic_int m_connectMismatches { 0 };
std::atomic_int m_fsdConnectMismatches { 0 }; //!< FSD no longer connected?
std::atomic_int m_retryConnectAttempt { 0 }; //!< Try to connect the n-th time
std::atomic_bool m_isStarted { false };
std::atomic_bool m_loopbackOn { false };
std::atomic_bool m_enableAliased { true };