[AFV] Ref T739, reduce verbose log message

This commit is contained in:
Klaus Basan
2019-10-17 01:44:10 +02:00
parent f236b54084
commit 1e7bc8a80f
2 changed files with 17 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
#include "blackmisc/network/external/qjsonwebtoken.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/stringutils.h"
#include "blackconfig/buildconfig.h"
#include <QJsonObject>
#include <QJsonArray>
@@ -23,6 +24,7 @@
using namespace BlackMisc;
using namespace BlackMisc::Network;
using namespace BlackConfig;
namespace BlackCore
{
@@ -297,7 +299,15 @@ namespace BlackCore
{
if (QDateTime::currentDateTimeUtc() > m_expiryLocalUtc.addSecs(-5 * 60))
{
this->connectTo(m_username, m_password, m_client, m_networkVersion, { this, [ = ](bool) {}});
QPointer<CApiServerConnection> myself(this);
this->connectTo(m_username, m_password, m_client, m_networkVersion,
{
this, [ = ](bool authenticated)
{
if (!myself) { return; }
CLogMessage(this).info(u"API server authenticated '%1': %2") << m_username << boolToYesNo(authenticated);
}
});
}
}
@@ -316,7 +326,9 @@ namespace BlackCore
void CApiServerConnection::logRequestDuration(const QNetworkReply *reply, const QString &addMsg)
{
if (!CBuildConfig::isLocalDeveloperDebugBuild()) { return; }
if (!reply) { return; }
const qint64 d = CNetworkUtils::requestDuration(reply);
if (d < 0) { return; }
if (addMsg.isEmpty())

View File

@@ -8,9 +8,11 @@
#include "clientconnection.h"
#include "blackmisc/logmessage.h"
#include "blackconfig/buildconfig.h"
#include <QNetworkDatagram>
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackCore::Afv::Crypto;
@@ -158,7 +160,7 @@ namespace BlackCore
else if (deserializer.dtoNameBuffer == HeartbeatAckDto::getShortDtoName())
{
m_connection.setTsHeartbeatToNow();
CLogMessage(this).debug(u"Received voice server heartbeat");
if (CBuildConfig::isLocalDeveloperDebugBuild()) { CLogMessage(this).debug(u"Received voice server heartbeat"); }
}
else
{
@@ -175,7 +177,7 @@ namespace BlackCore
void CClientConnection::voiceServerHeartbeat()
{
const QUrl voiceServerUrl("udp://" + m_connection.getTokens().VoiceServer.addressIpV4);
CLogMessage(this).debug(u"Sending voice server heartbeat to '%1'") << voiceServerUrl.host();
if (CBuildConfig::isLocalDeveloperDebugBuild()) { CLogMessage(this).debug(u"Sending voice server heartbeat to '%1'") << voiceServerUrl.host(); }
HeartbeatDto keepAlive;
keepAlive.callsign = m_connection.getCallsign().toStdString();
const QByteArray dataBytes = CryptoDtoSerializer::serialize(*m_connection.m_voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, keepAlive);