mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 19:49:18 +02:00
put networking library into its own QLoggingCategory
This commit is contained in:
parent
d5832f04dc
commit
cb7ff86386
16 changed files with 178 additions and 128 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "SharedUtil.h"
|
||||
|
||||
#include "AccountManager.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
||||
|
||||
|
@ -98,9 +99,9 @@ void AccountManager::logout() {
|
|||
QStringList path = QStringList() << ACCOUNTS_GROUP << keyURLString;
|
||||
Setting::Handle<DataServerAccountInfo>(path).remove();
|
||||
|
||||
qDebug() << "Removed account info for" << _authURL << "from in-memory accounts and .ini file";
|
||||
qCDebug(networking) << "Removed account info for" << _authURL << "from in-memory accounts and .ini file";
|
||||
} else {
|
||||
qDebug() << "Cleared data server account info in account manager.";
|
||||
qCDebug(networking) << "Cleared data server account info in account manager.";
|
||||
}
|
||||
|
||||
emit logoutComplete();
|
||||
|
@ -127,7 +128,7 @@ void AccountManager::setAuthURL(const QUrl& authURL) {
|
|||
if (_authURL != authURL) {
|
||||
_authURL = authURL;
|
||||
|
||||
qDebug() << "AccountManager URL for authenticated requests has been changed to" << qPrintable(_authURL.toString());
|
||||
qCDebug(networking) << "AccountManager URL for authenticated requests has been changed to" << qPrintable(_authURL.toString());
|
||||
|
||||
if (_shouldPersistToSettingsFile) {
|
||||
// check if there are existing access tokens to load from settings
|
||||
|
@ -142,7 +143,7 @@ void AccountManager::setAuthURL(const QUrl& authURL) {
|
|||
if (keyURL == _authURL) {
|
||||
// pull out the stored access token and store it in memory
|
||||
_accountInfo = settings.value(key).value<DataServerAccountInfo>();
|
||||
qDebug() << "Found a data-server access token for" << qPrintable(keyURL.toString());
|
||||
qCDebug(networking) << "Found a data-server access token for" << qPrintable(keyURL.toString());
|
||||
|
||||
// profile info isn't guaranteed to be saved too
|
||||
if (_accountInfo.hasProfile()) {
|
||||
|
@ -197,7 +198,7 @@ void AccountManager::sendRequest(const QString& path,
|
|||
_accountInfo.getAccessToken().authorizationHeaderValue());
|
||||
} else {
|
||||
if (authType == AccountManagerAuth::Required) {
|
||||
qDebug() << "No valid access token present. Bailing on invoked request to"
|
||||
qCDebug(networking) << "No valid access token present. Bailing on invoked request to"
|
||||
<< path << "that requires authentication";
|
||||
return;
|
||||
}
|
||||
|
@ -208,10 +209,10 @@ void AccountManager::sendRequest(const QString& path,
|
|||
networkRequest.setUrl(requestURL);
|
||||
|
||||
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
||||
qDebug() << "Making a request to" << qPrintable(requestURL.toString());
|
||||
qCDebug(networking) << "Making a request to" << qPrintable(requestURL.toString());
|
||||
|
||||
if (!dataByteArray.isEmpty()) {
|
||||
qDebug() << "The POST/PUT body -" << QString(dataByteArray);
|
||||
qCDebug(networking) << "The POST/PUT body -" << QString(dataByteArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,8 +299,8 @@ void AccountManager::passSuccessToCallback(QNetworkReply* requestReply) {
|
|||
|
||||
} else {
|
||||
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
||||
qDebug() << "Received JSON response from data-server that has no matching callback.";
|
||||
qDebug() << QJsonDocument::fromJson(requestReply->readAll());
|
||||
qCDebug(networking) << "Received JSON response from data-server that has no matching callback.";
|
||||
qCDebug(networking) << QJsonDocument::fromJson(requestReply->readAll());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,9 +317,9 @@ void AccountManager::passErrorToCallback(QNetworkReply* requestReply) {
|
|||
_pendingCallbackMap.remove(requestReply);
|
||||
} else {
|
||||
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
||||
qDebug() << "Received error response from data-server that has no matching callback.";
|
||||
qDebug() << "Error" << requestReply->error() << "-" << requestReply->errorString();
|
||||
qDebug() << requestReply->readAll();
|
||||
qCDebug(networking) << "Received error response from data-server that has no matching callback.";
|
||||
qCDebug(networking) << "Error" << requestReply->error() << "-" << requestReply->errorString();
|
||||
qCDebug(networking) << requestReply->readAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +338,7 @@ bool AccountManager::hasValidAccessToken() {
|
|||
if (_accountInfo.getAccessToken().token.isEmpty() || _accountInfo.getAccessToken().isExpired()) {
|
||||
|
||||
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
||||
qDebug() << "An access token is required for requests to" << qPrintable(_authURL.toString());
|
||||
qCDebug(networking) << "An access token is required for requests to" << qPrintable(_authURL.toString());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -365,7 +366,7 @@ void AccountManager::setAccessTokenForCurrentAuthURL(const QString& accessToken)
|
|||
OAuthAccessToken newOAuthToken;
|
||||
newOAuthToken.token = accessToken;
|
||||
|
||||
qDebug() << "Setting new account manager access token to" << accessToken;
|
||||
qCDebug(networking) << "Setting new account manager access token to" << accessToken;
|
||||
|
||||
_accountInfo.setAccessToken(newOAuthToken);
|
||||
}
|
||||
|
@ -409,13 +410,13 @@ void AccountManager::requestAccessTokenFinished() {
|
|||
if (!rootObject.contains("access_token") || !rootObject.contains("expires_in")
|
||||
|| !rootObject.contains("token_type")) {
|
||||
// TODO: error handling - malformed token response
|
||||
qDebug() << "Received a response for password grant that is missing one or more expected values.";
|
||||
qCDebug(networking) << "Received a response for password grant that is missing one or more expected values.";
|
||||
} else {
|
||||
// clear the path from the response URL so we have the right root URL for this access token
|
||||
QUrl rootURL = requestReply->url();
|
||||
rootURL.setPath("");
|
||||
|
||||
qDebug() << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
||||
qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
||||
|
||||
_accountInfo = DataServerAccountInfo();
|
||||
_accountInfo.setAccessTokenFromJSON(rootObject);
|
||||
|
@ -428,14 +429,14 @@ void AccountManager::requestAccessTokenFinished() {
|
|||
}
|
||||
} else {
|
||||
// TODO: error handling
|
||||
qDebug() << "Error in response for password grant -" << rootObject["error_description"].toString();
|
||||
qCDebug(networking) << "Error in response for password grant -" << rootObject["error_description"].toString();
|
||||
emit loginFailed();
|
||||
}
|
||||
}
|
||||
|
||||
void AccountManager::requestAccessTokenError(QNetworkReply::NetworkError error) {
|
||||
// TODO: error handling
|
||||
qDebug() << "AccountManager requestError - " << error;
|
||||
qCDebug(networking) << "AccountManager requestError - " << error;
|
||||
}
|
||||
|
||||
void AccountManager::requestProfile() {
|
||||
|
@ -472,13 +473,13 @@ void AccountManager::requestProfileFinished() {
|
|||
|
||||
} else {
|
||||
// TODO: error handling
|
||||
qDebug() << "Error in response for profile";
|
||||
qCDebug(networking) << "Error in response for profile";
|
||||
}
|
||||
}
|
||||
|
||||
void AccountManager::requestProfileError(QNetworkReply::NetworkError error) {
|
||||
// TODO: error handling
|
||||
qDebug() << "AccountManager requestProfileError - " << error;
|
||||
qCDebug(networking) << "AccountManager requestProfileError - " << error;
|
||||
}
|
||||
|
||||
void AccountManager::generateNewKeypair() {
|
||||
|
@ -498,13 +499,13 @@ void AccountManager::generateNewKeypair() {
|
|||
|
||||
keypairGenerator->moveToThread(generateThread);
|
||||
|
||||
qDebug() << "Starting worker thread to generate 2048-bit RSA key-pair.";
|
||||
qCDebug(networking) << "Starting worker thread to generate 2048-bit RSA key-pair.";
|
||||
generateThread->start();
|
||||
}
|
||||
|
||||
void AccountManager::processGeneratedKeypair(const QByteArray& publicKey, const QByteArray& privateKey) {
|
||||
|
||||
qDebug() << "Generated 2048-bit RSA key-pair. Storing private key and uploading public key.";
|
||||
qCDebug(networking) << "Generated 2048-bit RSA key-pair. Storing private key and uploading public key.";
|
||||
|
||||
// set the private key on our data-server account info
|
||||
_accountInfo.setPrivateKey(privateKey);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <UUID.h>
|
||||
|
||||
#include "NodeList.h"
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
#include "AddressManager.h"
|
||||
|
||||
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
||||
|
@ -74,7 +74,7 @@ const QString AddressManager::currentPath(bool withOrientation) const {
|
|||
QString orientationString = createByteArray(_orientationGetter());
|
||||
pathString += "/" + orientationString;
|
||||
} else {
|
||||
qDebug() << "Cannot add orientation to path without a getter for position."
|
||||
qCDebug(networking) << "Cannot add orientation to path without a getter for position."
|
||||
<< "Call AddressManager::setOrientationGetter to pass a function that will return a glm::quat";
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ const QString AddressManager::currentPath(bool withOrientation) const {
|
|||
|
||||
return pathString;
|
||||
} else {
|
||||
qDebug() << "Cannot create address path without a getter for position."
|
||||
qCDebug(networking) << "Cannot create address path without a getter for position."
|
||||
<< "Call AddressManager::setPositionGetter to pass a function that will return a const glm::vec3&";
|
||||
return QString();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
|
|||
bool AddressManager::handleUrl(const QUrl& lookupUrl) {
|
||||
if (lookupUrl.scheme() == HIFI_URL_SCHEME) {
|
||||
|
||||
qDebug() << "Trying to go to URL" << lookupUrl.toString();
|
||||
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
|
||||
|
||||
// there are 4 possible lookup strings
|
||||
|
||||
|
@ -132,7 +132,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl) {
|
|||
|
||||
return true;
|
||||
} else if (lookupUrl.toString().startsWith('/')) {
|
||||
qDebug() << "Going to relative path" << lookupUrl.path();
|
||||
qCDebug(networking) << "Going to relative path" << lookupUrl.path();
|
||||
|
||||
// if this is a relative path then handle it as a relative viewpoint
|
||||
handleRelativeViewpoint(lookupUrl.path());
|
||||
|
@ -211,7 +211,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
|
|||
? domainObject[DOMAIN_NETWORK_PORT_KEY].toUInt()
|
||||
: DEFAULT_DOMAIN_SERVER_PORT;
|
||||
|
||||
qDebug() << "Possible domain change required to connect to" << domainHostname
|
||||
qCDebug(networking) << "Possible domain change required to connect to" << domainHostname
|
||||
<< "on" << domainPort;
|
||||
emit possibleDomainChangeRequired(domainHostname, domainPort);
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
|
|||
QString domainIDString = domainObject[DOMAIN_ID_KEY].toString();
|
||||
QUuid domainID(domainIDString);
|
||||
|
||||
qDebug() << "Possible domain change required to connect to domain with ID" << domainID
|
||||
qCDebug(networking) << "Possible domain change required to connect to domain with ID" << domainID
|
||||
<< "via ice-server at" << iceServerAddress;
|
||||
|
||||
emit possibleDomainChangeRequiredViaICEForID(iceServerAddress, domainID);
|
||||
|
@ -241,7 +241,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
|
|||
|
||||
if (!overridePath.isEmpty()) {
|
||||
if (!handleRelativeViewpoint(overridePath)){
|
||||
qDebug() << "User entered path could not be handled as a viewpoint - " << overridePath;
|
||||
qCDebug(networking) << "User entered path could not be handled as a viewpoint - " << overridePath;
|
||||
}
|
||||
} else {
|
||||
// take the path that came back
|
||||
|
@ -253,28 +253,28 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
|
|||
if (!returnedPath.isEmpty()) {
|
||||
// try to parse this returned path as a viewpoint, that's the only thing it could be for now
|
||||
if (!handleRelativeViewpoint(returnedPath, shouldFaceViewpoint)) {
|
||||
qDebug() << "Received a location path that was could not be handled as a viewpoint -" << returnedPath;
|
||||
qCDebug(networking) << "Received a location path that was could not be handled as a viewpoint -" << returnedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
qDebug() << "Received an address manager API response with no domain key. Cannot parse.";
|
||||
qDebug() << locationMap;
|
||||
qCDebug(networking) << "Received an address manager API response with no domain key. Cannot parse.";
|
||||
qCDebug(networking) << locationMap;
|
||||
}
|
||||
} else {
|
||||
// we've been told that this result exists but is offline, emit our signal so the application can handle
|
||||
emit lookupResultIsOffline();
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Received an address manager API response with no location key or place key. Cannot parse.";
|
||||
qDebug() << locationMap;
|
||||
qCDebug(networking) << "Received an address manager API response with no location key or place key. Cannot parse.";
|
||||
qCDebug(networking) << locationMap;
|
||||
}
|
||||
}
|
||||
|
||||
void AddressManager::handleAPIError(QNetworkReply& errorReply) {
|
||||
qDebug() << "AddressManager API error -" << errorReply.error() << "-" << errorReply.errorString();
|
||||
qCDebug(networking) << "AddressManager API error -" << errorReply.error() << "-" << errorReply.errorString();
|
||||
|
||||
if (errorReply.error() == QNetworkReply::ContentNotFoundError) {
|
||||
emit lookupResultIsNotFound();
|
||||
|
@ -379,14 +379,14 @@ bool AddressManager::handleRelativeViewpoint(const QString& lookupString, bool s
|
|||
emit locationChangeRequired(newPosition, true, newOrientation, shouldFace);
|
||||
return true;
|
||||
} else {
|
||||
qDebug() << "Orientation parsed from lookup string is invalid. Will not use for location change.";
|
||||
qCDebug(networking) << "Orientation parsed from lookup string is invalid. Will not use for location change.";
|
||||
}
|
||||
}
|
||||
|
||||
emit locationChangeRequired(newPosition, false, newOrientation, shouldFace);
|
||||
|
||||
} else {
|
||||
qDebug() << "Could not jump to position from lookup string because it has an invalid value.";
|
||||
qCDebug(networking) << "Could not jump to position from lookup string because it has an invalid value.";
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -422,7 +422,7 @@ void AddressManager::setDomainInfo(const QString& hostname, quint16 port) {
|
|||
_rootPlaceName = hostname;
|
||||
_rootPlaceID = QUuid();
|
||||
|
||||
qDebug() << "Possible domain change required to connect to domain at" << hostname << "on" << port;
|
||||
qCDebug(networking) << "Possible domain change required to connect to domain at" << hostname << "on" << port;
|
||||
|
||||
emit possibleDomainChangeRequired(hostname, port);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#include <qjsondocument.h>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
#include "DataServerAccountInfo.h"
|
||||
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
DataServerAccountInfo::DataServerAccountInfo() :
|
||||
|
@ -72,7 +74,7 @@ void DataServerAccountInfo::setUsername(const QString& username) {
|
|||
// clear our username signature so it has to be re-created
|
||||
_usernameSignature = QByteArray();
|
||||
|
||||
qDebug() << "Username changed to" << username;
|
||||
qCDebug(networking) << "Username changed to" << username;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,16 +142,16 @@ const QByteArray& DataServerAccountInfo::getUsernameSignature() {
|
|||
rsaPrivateKey, RSA_PKCS1_PADDING);
|
||||
|
||||
if (encryptReturn == -1) {
|
||||
qDebug() << "Error encrypting username signature.";
|
||||
qDebug() << "Will re-attempt on next domain-server check in.";
|
||||
qCDebug(networking) << "Error encrypting username signature.";
|
||||
qCDebug(networking) << "Will re-attempt on next domain-server check in.";
|
||||
_usernameSignature = QByteArray();
|
||||
}
|
||||
|
||||
// free the private key RSA struct now that we are done with it
|
||||
RSA_free(rsaPrivateKey);
|
||||
} else {
|
||||
qDebug() << "Could not create RSA struct from QByteArray private key.";
|
||||
qDebug() << "Will re-attempt on next domain-server check in.";
|
||||
qCDebug(networking) << "Could not create RSA struct from QByteArray private key.";
|
||||
qCDebug(networking) << "Will re-attempt on next domain-server check in.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "UserActivityLogger.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include "DomainHandler.h"
|
||||
|
||||
|
@ -57,7 +58,7 @@ void DomainHandler::clearSettings() {
|
|||
}
|
||||
|
||||
void DomainHandler::softReset() {
|
||||
qDebug() << "Resetting current domain connection information.";
|
||||
qCDebug(networking) << "Resetting current domain connection information.";
|
||||
clearConnectionInfo();
|
||||
clearSettings();
|
||||
}
|
||||
|
@ -65,7 +66,7 @@ void DomainHandler::softReset() {
|
|||
void DomainHandler::hardReset() {
|
||||
softReset();
|
||||
|
||||
qDebug() << "Hard reset in NodeList DomainHandler.";
|
||||
qCDebug(networking) << "Hard reset in NodeList DomainHandler.";
|
||||
_iceDomainID = QUuid();
|
||||
_iceServerSockAddr = HifiSockAddr();
|
||||
_hostname = QString();
|
||||
|
@ -87,7 +88,7 @@ void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr, const QString& hos
|
|||
void DomainHandler::setUUID(const QUuid& uuid) {
|
||||
if (uuid != _uuid) {
|
||||
_uuid = uuid;
|
||||
qDebug() << "Domain ID changed to" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
qCDebug(networking) << "Domain ID changed to" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,10 +102,10 @@ void DomainHandler::setHostnameAndPort(const QString& hostname, quint16 port) {
|
|||
// set the new hostname
|
||||
_hostname = hostname;
|
||||
|
||||
qDebug() << "Updated domain hostname to" << _hostname;
|
||||
qCDebug(networking) << "Updated domain hostname to" << _hostname;
|
||||
|
||||
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
|
||||
qDebug("Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
||||
qCDebug(networking, "Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
||||
QHostInfo::lookupHost(_hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||
|
||||
UserActivityLogger::getInstance().changedDomain(_hostname);
|
||||
|
@ -112,7 +113,7 @@ void DomainHandler::setHostnameAndPort(const QString& hostname, quint16 port) {
|
|||
}
|
||||
|
||||
if (_sockAddr.getPort() != port) {
|
||||
qDebug() << "Updated domain port to" << port;
|
||||
qCDebug(networking) << "Updated domain port to" << port;
|
||||
}
|
||||
|
||||
// grab the port by reading the string after the colon
|
||||
|
@ -134,7 +135,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
|
|||
// refresh our ICE client UUID to something new
|
||||
_iceClientID = QUuid::createUuid();
|
||||
|
||||
qDebug() << "ICE required to connect to domain via ice server at" << iceServerHostname;
|
||||
qCDebug(networking) << "ICE required to connect to domain via ice server at" << iceServerHostname;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,14 +153,14 @@ void DomainHandler::completedHostnameLookup(const QHostInfo& hostInfo) {
|
|||
for (int i = 0; i < hostInfo.addresses().size(); i++) {
|
||||
if (hostInfo.addresses()[i].protocol() == QAbstractSocket::IPv4Protocol) {
|
||||
_sockAddr.setAddress(hostInfo.addresses()[i]);
|
||||
qDebug("DS at %s is at %s", _hostname.toLocal8Bit().constData(),
|
||||
qCDebug(networking, "DS at %s is at %s", _hostname.toLocal8Bit().constData(),
|
||||
_sockAddr.getAddress().toString().toLocal8Bit().constData());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if we got here then we failed to lookup the address
|
||||
qDebug("Failed domain server lookup");
|
||||
qCDebug(networking, "Failed domain server lookup");
|
||||
}
|
||||
|
||||
void DomainHandler::setIsConnected(bool isConnected) {
|
||||
|
@ -195,7 +196,7 @@ void DomainHandler::requestDomainSettings() {
|
|||
Assignment::Type assignmentType = Assignment::typeForNodeType(DependencyManager::get<NodeList>()->getOwnerType());
|
||||
settingsJSONURL.setQuery(QString("type=%1").arg(assignmentType));
|
||||
|
||||
qDebug() << "Requesting domain-server settings at" << settingsJSONURL.toString();
|
||||
qCDebug(networking) << "Requesting domain-server settings at" << settingsJSONURL.toString();
|
||||
|
||||
QNetworkRequest settingsRequest(settingsJSONURL);
|
||||
settingsRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||
|
@ -216,7 +217,7 @@ void DomainHandler::settingsRequestFinished() {
|
|||
// parse the JSON to a QJsonObject and save it
|
||||
_settingsObject = QJsonDocument::fromJson(settingsReply->readAll()).object();
|
||||
|
||||
qDebug() << "Received domain settings.";
|
||||
qCDebug(networking) << "Received domain settings.";
|
||||
emit settingsReceived(_settingsObject);
|
||||
|
||||
// reset failed settings requests to 0, we got them
|
||||
|
@ -224,10 +225,10 @@ void DomainHandler::settingsRequestFinished() {
|
|||
} else {
|
||||
// error grabbing the settings - in some cases this means we are stuck
|
||||
// so we should retry until we get it
|
||||
qDebug() << "Error getting domain settings -" << settingsReply->errorString() << "- retrying";
|
||||
qCDebug(networking) << "Error getting domain settings -" << settingsReply->errorString() << "- retrying";
|
||||
|
||||
if (++_failedSettingsRequests >= MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS) {
|
||||
qDebug() << "Failed to retreive domain-server settings" << MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS
|
||||
qCDebug(networking) << "Failed to retreive domain-server settings" << MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS
|
||||
<< "times. Re-setting connection to domain.";
|
||||
clearSettings();
|
||||
clearConnectionInfo();
|
||||
|
@ -246,7 +247,7 @@ void DomainHandler::parseDTLSRequirementPacket(const QByteArray& dtlsRequirement
|
|||
unsigned short dtlsPort = 0;
|
||||
memcpy(&dtlsPort, dtlsRequirementPacket.data() + numBytesPacketHeader, sizeof(dtlsPort));
|
||||
|
||||
qDebug() << "domain-server DTLS port changed to" << dtlsPort << "- Enabling DTLS.";
|
||||
qCDebug(networking) << "domain-server DTLS port changed to" << dtlsPort << "- Enabling DTLS.";
|
||||
|
||||
_sockAddr.setPort(dtlsPort);
|
||||
|
||||
|
@ -261,9 +262,9 @@ void DomainHandler::processICEResponsePacket(const QByteArray& icePacket) {
|
|||
iceResponseStream >> packetPeer;
|
||||
|
||||
if (packetPeer.getUUID() != _iceDomainID) {
|
||||
qDebug() << "Received a network peer with ID that does not match current domain. Will not attempt connection.";
|
||||
qCDebug(networking) << "Received a network peer with ID that does not match current domain. Will not attempt connection.";
|
||||
} else {
|
||||
qDebug() << "Received network peer object for domain -" << packetPeer;
|
||||
qCDebug(networking) << "Received network peer object for domain -" << packetPeer;
|
||||
_icePeer = packetPeer;
|
||||
|
||||
emit requestICEConnectionAttempt();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <qnetworkinterface.h>
|
||||
|
||||
#include "HifiSockAddr.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
static int hifiSockAddrMetaTypeId = qMetaTypeId<HifiSockAddr>();
|
||||
|
||||
|
@ -52,12 +53,12 @@ HifiSockAddr::HifiSockAddr(const QString& hostname, quint16 hostOrderPort, bool
|
|||
if (_address.protocol() != QAbstractSocket::IPv4Protocol) {
|
||||
// lookup the IP by the hostname
|
||||
if (shouldBlockForLookup) {
|
||||
qDebug() << "Synchronously looking up IP address for hostname" << hostname;
|
||||
qCDebug(networking) << "Synchronously looking up IP address for hostname" << hostname;
|
||||
QHostInfo result = QHostInfo::fromName(hostname);
|
||||
handleLookupResult(result);
|
||||
} else {
|
||||
int lookupID = QHostInfo::lookupHost(hostname, this, SLOT(handleLookupResult(QHostInfo)));
|
||||
qDebug() << "Asynchronously looking up IP address for hostname" << hostname << "- lookup ID is" << lookupID;
|
||||
qCDebug(networking) << "Asynchronously looking up IP address for hostname" << hostname << "- lookup ID is" << lookupID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ bool HifiSockAddr::operator==(const HifiSockAddr& rhsSockAddr) const {
|
|||
|
||||
void HifiSockAddr::handleLookupResult(const QHostInfo& hostInfo) {
|
||||
if (hostInfo.error() != QHostInfo::NoError) {
|
||||
qDebug() << "Lookup failed for" << hostInfo.lookupId() << ":" << hostInfo.errorString();
|
||||
qCDebug(networking) << "Lookup failed for" << hostInfo.lookupId() << ":" << hostInfo.errorString();
|
||||
emit lookupFailed();
|
||||
}
|
||||
|
||||
|
@ -93,7 +94,7 @@ void HifiSockAddr::handleLookupResult(const QHostInfo& hostInfo) {
|
|||
// just take the first IPv4 address
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol) {
|
||||
_address = address;
|
||||
qDebug() << "QHostInfo lookup result for"
|
||||
qCDebug(networking) << "QHostInfo lookup result for"
|
||||
<< hostInfo.hostName() << "with lookup ID" << hostInfo.lookupId() << "is" << address.toString();
|
||||
emit lookupCompleted();
|
||||
break;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "UUID.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
const char SOLO_NODE_TYPES[2] = {
|
||||
NodeType::AvatarMixer,
|
||||
|
@ -60,14 +61,14 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
|||
}
|
||||
|
||||
_nodeSocket.bind(QHostAddress::AnyIPv4, socketListenPort);
|
||||
qDebug() << "NodeList socket is listening on" << _nodeSocket.localPort();
|
||||
qCDebug(networking) << "NodeList socket is listening on" << _nodeSocket.localPort();
|
||||
|
||||
if (dtlsListenPort > 0) {
|
||||
// only create the DTLS socket during constructor if a custom port is passed
|
||||
_dtlsSocket = new QUdpSocket(this);
|
||||
|
||||
_dtlsSocket->bind(QHostAddress::AnyIPv4, dtlsListenPort);
|
||||
qDebug() << "NodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
qCDebug(networking) << "NodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
}
|
||||
|
||||
const int LARGER_BUFFER_SIZE = 1048576;
|
||||
|
@ -94,7 +95,7 @@ void LimitedNodeList::setSessionUUID(const QUuid& sessionUUID) {
|
|||
_sessionUUID = sessionUUID;
|
||||
|
||||
if (sessionUUID != oldUUID) {
|
||||
qDebug() << "NodeList UUID changed from" << uuidStringWithoutCurlyBraces(oldUUID)
|
||||
qCDebug(networking) << "NodeList UUID changed from" << uuidStringWithoutCurlyBraces(oldUUID)
|
||||
<< "to" << uuidStringWithoutCurlyBraces(_sessionUUID);
|
||||
emit uuidChanged(sessionUUID, oldUUID);
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ QUdpSocket& LimitedNodeList::getDTLSSocket() {
|
|||
// DTLS requires that IP_DONTFRAG be set
|
||||
// This is not accessible on some platforms (OS X) so we need to make sure DTLS still works without it
|
||||
|
||||
qDebug() << "LimitedNodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
qCDebug(networking) << "LimitedNodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
}
|
||||
|
||||
return *_dtlsSocket;
|
||||
|
@ -147,11 +148,11 @@ void LimitedNodeList::changeSocketBufferSizes(int numBytes) {
|
|||
if (oldBufferSize < numBytes) {
|
||||
int newBufferSize = _nodeSocket.socketOption(bufferOpt).toInt();
|
||||
|
||||
qDebug() << "Changed socket" << bufferTypeString << "buffer size from" << oldBufferSize << "to"
|
||||
qCDebug(networking) << "Changed socket" << bufferTypeString << "buffer size from" << oldBufferSize << "to"
|
||||
<< newBufferSize << "bytes";
|
||||
} else {
|
||||
// don't make the buffer smaller
|
||||
qDebug() << "Did not change socket" << bufferTypeString << "buffer size from" << oldBufferSize
|
||||
qCDebug(networking) << "Did not change socket" << bufferTypeString << "buffer size from" << oldBufferSize
|
||||
<< "since it is larger than desired size of" << numBytes;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +170,7 @@ bool LimitedNodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
|||
|
||||
QUuid senderUUID = uuidFromPacketHeader(packet);
|
||||
if (!versionDebugSuppressMap.contains(senderUUID, checkType)) {
|
||||
qDebug() << "Packet version mismatch on" << packetTypeForPacket(packet) << "- Sender"
|
||||
qCDebug(networking) << "Packet version mismatch on" << packetTypeForPacket(packet) << "- Sender"
|
||||
<< uuidFromPacketHeader(packet) << "sent" << qPrintable(QString::number(packet[numPacketTypeBytes])) << "but"
|
||||
<< qPrintable(QString::number(versionForPacketType(mismatchType))) << "expected.";
|
||||
|
||||
|
@ -193,7 +194,7 @@ bool LimitedNodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
|||
|
||||
QUuid senderUUID = uuidFromPacketHeader(packet);
|
||||
if (!hashDebugSuppressMap.contains(senderUUID, checkType)) {
|
||||
qDebug() << "Packet hash mismatch on" << checkType << "- Sender"
|
||||
qCDebug(networking) << "Packet hash mismatch on" << checkType << "- Sender"
|
||||
<< uuidFromPacketHeader(packet);
|
||||
|
||||
hashDebugSuppressMap.insert(senderUUID, checkType);
|
||||
|
@ -203,7 +204,7 @@ bool LimitedNodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
|||
static QString repeatedMessage
|
||||
= LogHandler::getInstance().addRepeatedMessageRegex("Packet of type \\d+ received from unknown node with UUID");
|
||||
|
||||
qDebug() << "Packet of type" << checkType << "received from unknown node with UUID"
|
||||
qCDebug(networking) << "Packet of type" << checkType << "received from unknown node with UUID"
|
||||
<< qPrintable(uuidStringWithoutCurlyBraces(uuidFromPacketHeader(packet)));
|
||||
}
|
||||
} else {
|
||||
|
@ -246,7 +247,7 @@ qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram, const HifiSock
|
|||
destinationSockAddr.getAddress(), destinationSockAddr.getPort());
|
||||
|
||||
if (bytesWritten < 0) {
|
||||
qDebug() << "ERROR in writeDatagram:" << _nodeSocket.error() << "-" << _nodeSocket.errorString();
|
||||
qCDebug(networking) << "ERROR in writeDatagram:" << _nodeSocket.error() << "-" << _nodeSocket.errorString();
|
||||
}
|
||||
|
||||
return bytesWritten;
|
||||
|
@ -368,7 +369,7 @@ SharedNodePointer LimitedNodeList::sendingNodeForPacket(const QByteArray& packet
|
|||
}
|
||||
|
||||
void LimitedNodeList::eraseAllNodes() {
|
||||
qDebug() << "Clearing the NodeList. Deleting all nodes in list.";
|
||||
qCDebug(networking) << "Clearing the NodeList. Deleting all nodes in list.";
|
||||
|
||||
QSet<SharedNodePointer> killedNodes;
|
||||
eachNode([&killedNodes](const SharedNodePointer& node){
|
||||
|
@ -417,7 +418,7 @@ void LimitedNodeList::processKillNode(const QByteArray& dataByteArray) {
|
|||
}
|
||||
|
||||
void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) {
|
||||
qDebug() << "Killed" << *node;
|
||||
qCDebug(networking) << "Killed" << *node;
|
||||
emit nodeKilled(node);
|
||||
}
|
||||
|
||||
|
@ -442,7 +443,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
|
||||
_nodeHash.insert(UUIDNodePair(newNode->getUUID(), newNodePointer));
|
||||
|
||||
qDebug() << "Added" << *newNode;
|
||||
qCDebug(networking) << "Added" << *newNode;
|
||||
|
||||
emit nodeAdded(newNodePointer);
|
||||
|
||||
|
@ -629,7 +630,7 @@ bool LimitedNodeList::processSTUNResponse(const QByteArray& packet) {
|
|||
if (newPublicAddress != _publicSockAddr.getAddress() || newPublicPort != _publicSockAddr.getPort()) {
|
||||
_publicSockAddr = HifiSockAddr(newPublicAddress, newPublicPort);
|
||||
|
||||
qDebug("New public socket received from STUN server is %s:%hu",
|
||||
qCDebug(networking, "New public socket received from STUN server is %s:%hu",
|
||||
_publicSockAddr.getAddress().toString().toLocal8Bit().constData(),
|
||||
_publicSockAddr.getPort());
|
||||
|
||||
|
@ -660,9 +661,9 @@ void LimitedNodeList::updateLocalSockAddr() {
|
|||
if (newSockAddr != _localSockAddr) {
|
||||
|
||||
if (_localSockAddr.isNull()) {
|
||||
qDebug() << "Local socket is" << newSockAddr;
|
||||
qCDebug(networking) << "Local socket is" << newSockAddr;
|
||||
} else {
|
||||
qDebug() << "Local socket has changed from" << _localSockAddr << "to" << newSockAddr;
|
||||
qCDebug(networking) << "Local socket has changed from" << _localSockAddr << "to" << newSockAddr;
|
||||
}
|
||||
|
||||
_localSockAddr = newSockAddr;
|
||||
|
@ -686,7 +687,7 @@ void LimitedNodeList::sendHeartbeatToIceServer(const HifiSockAddr& iceServerSock
|
|||
if (!connectionRequestID.isNull()) {
|
||||
iceDataStream << connectionRequestID;
|
||||
|
||||
qDebug() << "Sending packet to ICE server to request connection info for peer with ID"
|
||||
qCDebug(networking) << "Sending packet to ICE server to request connection info for peer with ID"
|
||||
<< uuidStringWithoutCurlyBraces(connectionRequestID);
|
||||
}
|
||||
|
||||
|
@ -703,7 +704,7 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p
|
|||
memcpy(sharedPortMem->data(), &localPort, sizeof(localPort));
|
||||
sharedPortMem->unlock();
|
||||
|
||||
qDebug() << "Wrote local listening port" << localPort << "to shared memory at key" << key;
|
||||
qCDebug(networking) << "Wrote local listening port" << localPort << "to shared memory at key" << key;
|
||||
} else {
|
||||
qWarning() << "Failed to create and attach to shared memory to share local port with assignment-client children.";
|
||||
}
|
||||
|
|
15
libraries/networking/src/NetworkLogging.cpp
Normal file
15
libraries/networking/src/NetworkLogging.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// NetworkLogging.cpp
|
||||
// libraries/networking/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(networking, "hifi.networking")
|
15
libraries/networking/src/NetworkLogging.h
Normal file
15
libraries/networking/src/NetworkLogging.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// NetworkLogging.h
|
||||
// libraries/networking/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(networking)
|
|
@ -14,6 +14,7 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include "NetworkPacket.h"
|
||||
|
||||
|
@ -22,7 +23,7 @@ void NetworkPacket::copyContents(const SharedNodePointer& node, const QByteArray
|
|||
_node = node;
|
||||
_byteArray = packet;
|
||||
} else {
|
||||
qDebug(">>> NetworkPacket::copyContents() unexpected length = %d", packet.size());
|
||||
qCDebug(networking, ">>> NetworkPacket::copyContents() unexpected length = %d", packet.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "Node.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QtCore/QDebug>
|
||||
|
@ -76,7 +77,7 @@ void Node::setPublicSocket(const HifiSockAddr& publicSocket) {
|
|||
}
|
||||
|
||||
if (!_publicSocket.isNull()) {
|
||||
qDebug() << "Public socket change for node" << *this;
|
||||
qCDebug(networking) << "Public socket change for node" << *this;
|
||||
}
|
||||
|
||||
_publicSocket = publicSocket;
|
||||
|
@ -91,7 +92,7 @@ void Node::setLocalSocket(const HifiSockAddr& localSocket) {
|
|||
}
|
||||
|
||||
if (!_localSocket.isNull()) {
|
||||
qDebug() << "Local socket change for node" << *this;
|
||||
qCDebug(networking) << "Local socket change for node" << *this;
|
||||
}
|
||||
|
||||
_localSocket = localSocket;
|
||||
|
@ -106,7 +107,7 @@ void Node::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
|
|||
}
|
||||
|
||||
if (!_symmetricSocket.isNull()) {
|
||||
qDebug() << "Symmetric socket change for node" << *this;
|
||||
qCDebug(networking) << "Symmetric socket change for node" << *this;
|
||||
}
|
||||
|
||||
_symmetricSocket = symmetricSocket;
|
||||
|
@ -114,17 +115,17 @@ void Node::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
|
|||
}
|
||||
|
||||
void Node::activateLocalSocket() {
|
||||
qDebug() << "Activating local socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
qCDebug(networking) << "Activating local socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
_activeSocket = &_localSocket;
|
||||
}
|
||||
|
||||
void Node::activatePublicSocket() {
|
||||
qDebug() << "Activating public socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
qCDebug(networking) << "Activating public socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
_activeSocket = &_publicSocket;
|
||||
}
|
||||
|
||||
void Node::activateSymmetricSocket() {
|
||||
qDebug() << "Activating symmetric socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
qCDebug(networking) << "Activating symmetric socket for network peer with ID" << uuidStringWithoutCurlyBraces(_uuid);
|
||||
_activeSocket = &_symmetricSocket;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "UUID.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned short dtlsListenPort) :
|
||||
LimitedNodeList(socketListenPort, dtlsListenPort),
|
||||
|
@ -99,7 +100,7 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
|
|||
const bool wantDebug = false;
|
||||
|
||||
if (wantDebug) {
|
||||
qDebug() << "PING_REPLY from node " << *sendingNode << "\n" <<
|
||||
qCDebug(networking) << "PING_REPLY from node " << *sendingNode << "\n" <<
|
||||
" now: " << now << "\n" <<
|
||||
" ourTime: " << ourOriginalTime << "\n" <<
|
||||
" pingTime: " << pingTime << "\n" <<
|
||||
|
@ -167,17 +168,17 @@ void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteAr
|
|||
break;
|
||||
}
|
||||
case PacketTypeUnverifiedPingReply: {
|
||||
qDebug() << "Received reply from domain-server on" << senderSockAddr;
|
||||
qCDebug(networking) << "Received reply from domain-server on" << senderSockAddr;
|
||||
|
||||
// for now we're unsafely assuming this came back from the domain
|
||||
if (senderSockAddr == _domainHandler.getICEPeer().getLocalSocket()) {
|
||||
qDebug() << "Connecting to domain using local socket";
|
||||
qCDebug(networking) << "Connecting to domain using local socket";
|
||||
_domainHandler.activateICELocalSocket();
|
||||
} else if (senderSockAddr == _domainHandler.getICEPeer().getPublicSocket()) {
|
||||
qDebug() << "Conecting to domain using public socket";
|
||||
qCDebug(networking) << "Conecting to domain using public socket";
|
||||
_domainHandler.activateICEPublicSocket();
|
||||
} else {
|
||||
qDebug() << "Reply does not match either local or public socket for domain. Will not connect.";
|
||||
qCDebug(networking) << "Reply does not match either local or public socket for domain. Will not connect.";
|
||||
}
|
||||
}
|
||||
case PacketTypeStunResponse: {
|
||||
|
@ -225,7 +226,7 @@ const unsigned int NUM_STUN_REQUESTS_BEFORE_FALLBACK = 5;
|
|||
void NodeList::sendSTUNRequest() {
|
||||
|
||||
if (!_hasCompletedInitialSTUNFailure) {
|
||||
qDebug() << "Sending intial stun request to" << STUN_SERVER_HOSTNAME;
|
||||
qCDebug(networking) << "Sending intial stun request to" << STUN_SERVER_HOSTNAME;
|
||||
}
|
||||
|
||||
LimitedNodeList::sendSTUNRequest();
|
||||
|
@ -236,7 +237,7 @@ void NodeList::sendSTUNRequest() {
|
|||
if (!_hasCompletedInitialSTUNFailure) {
|
||||
// if we're here this was the last failed STUN request
|
||||
// use our DS as our stun server
|
||||
qDebug("Failed to lookup public address via STUN server at %s:%hu. Using DS for STUN.",
|
||||
qCDebug(networking, "Failed to lookup public address via STUN server at %s:%hu. Using DS for STUN.",
|
||||
STUN_SERVER_HOSTNAME, STUN_SERVER_PORT);
|
||||
|
||||
_hasCompletedInitialSTUNFailure = true;
|
||||
|
@ -276,7 +277,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
? PacketTypeDomainConnectRequest : PacketTypeDomainListRequest;
|
||||
|
||||
if (!_domainHandler.isConnected()) {
|
||||
qDebug() << "Sending connect request to domain-server at" << _domainHandler.getHostname();
|
||||
qCDebug(networking) << "Sending connect request to domain-server at" << _domainHandler.getHostname();
|
||||
|
||||
// is this our localhost domain-server?
|
||||
// if so we need to make sure we have an up-to-date local port in case it restarted
|
||||
|
@ -290,7 +291,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY,
|
||||
localDSPortSharedMem,
|
||||
domainPort);
|
||||
qDebug() << "Local domain-server port read from shared memory (or default) is" << domainPort;
|
||||
qCDebug(networking) << "Local domain-server port read from shared memory (or default) is" << domainPort;
|
||||
_domainHandler.setPort(domainPort);
|
||||
}
|
||||
|
||||
|
@ -327,7 +328,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
const QByteArray& usernameSignature = AccountManager::getInstance().getAccountInfo().getUsernameSignature();
|
||||
|
||||
if (!usernameSignature.isEmpty()) {
|
||||
qDebug() << "Including username signature in domain connect request.";
|
||||
qCDebug(networking) << "Including username signature in domain connect request.";
|
||||
packetStream << usernameSignature;
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ void NodeList::handleICEConnectionToDomainServer() {
|
|||
_domainHandler.getICEClientID(),
|
||||
_domainHandler.getICEDomainID());
|
||||
} else {
|
||||
qDebug() << "Sending ping packets to establish connectivity with domain-server with ID"
|
||||
qCDebug(networking) << "Sending ping packets to establish connectivity with domain-server with ID"
|
||||
<< uuidStringWithoutCurlyBraces(_domainHandler.getICEDomainID());
|
||||
|
||||
// send the ping packet to the local and public sockets for this node
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include <qdebug.h>
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include "RSAKeypairGenerator.h"
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
|
@ -38,7 +40,7 @@ void RSAKeypairGenerator::generateKeypair() {
|
|||
const int RSA_KEY_BITS = 2048;
|
||||
|
||||
if (!RSA_generate_key_ex(keyPair, RSA_KEY_BITS, exponent, NULL)) {
|
||||
qDebug() << "Error generating 2048-bit RSA Keypair -" << ERR_get_error();
|
||||
qCDebug(networking) << "Error generating 2048-bit RSA Keypair -" << ERR_get_error();
|
||||
|
||||
emit errorGeneratingKeypair();
|
||||
|
||||
|
@ -58,7 +60,7 @@ void RSAKeypairGenerator::generateKeypair() {
|
|||
int privateKeyLength = i2d_RSAPrivateKey(keyPair, &privateKeyDER);
|
||||
|
||||
if (publicKeyLength <= 0 || privateKeyLength <= 0) {
|
||||
qDebug() << "Error getting DER public or private key from RSA struct -" << ERR_get_error();
|
||||
qCDebug(networking) << "Error getting DER public or private key from RSA struct -" << ERR_get_error();
|
||||
|
||||
emit errorGeneratingKeypair();
|
||||
|
||||
|
@ -89,4 +91,4 @@ void RSAKeypairGenerator::generateKeypair() {
|
|||
OPENSSL_free(privateKeyDER);
|
||||
|
||||
emit generatedKeypair(publicKeyArray, privateKeyArray);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "NetworkAccessManager.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include "ResourceCache.h"
|
||||
|
||||
#define clamp(x, min, max) (((x) < (min)) ? (min) :\
|
||||
|
@ -50,7 +52,7 @@ void ResourceCache::refresh(const QUrl& url) {
|
|||
}
|
||||
|
||||
void ResourceCache::getResourceAsynchronously(const QUrl& url) {
|
||||
qDebug() << "ResourceCache::getResourceAsynchronously" << url.toString();
|
||||
qCDebug(networking) << "ResourceCache::getResourceAsynchronously" << url.toString();
|
||||
_resourcesToBeGottenLock.lockForWrite();
|
||||
_resourcesToBeGotten.enqueue(QUrl(url));
|
||||
_resourcesToBeGottenLock.unlock();
|
||||
|
@ -354,10 +356,10 @@ void Resource::maybeRefresh() {
|
|||
}
|
||||
} else if (!variant.isValid() || !variant.canConvert<QDateTime>() ||
|
||||
!variant.value<QDateTime>().isValid() || variant.value<QDateTime>().isNull()) {
|
||||
qDebug() << "Cannot determine when" << _url.fileName() << "was modified last, cached version might be outdated";
|
||||
qCDebug(networking) << "Cannot determine when" << _url.fileName() << "was modified last, cached version might be outdated";
|
||||
return;
|
||||
}
|
||||
qDebug() << "Loaded" << _url.fileName() << "from the disk cache but the network version is newer, refreshing.";
|
||||
qCDebug(networking) << "Loaded" << _url.fileName() << "from the disk cache but the network version is newer, refreshing.";
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +443,7 @@ void Resource::handleReplyError(QNetworkReply::NetworkError error, QDebug debug)
|
|||
}
|
||||
|
||||
void Resource::handleReplyFinished() {
|
||||
qDebug() << "Got finished without download progress/error?" << _url;
|
||||
qCDebug(networking) << "Got finished without download progress/error?" << _url;
|
||||
handleDownloadProgress(0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,13 @@
|
|||
//
|
||||
|
||||
#include <limits>
|
||||
#include "NetworkLogging.h"
|
||||
#include "SentPacketHistory.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
|
||||
|
||||
|
||||
SentPacketHistory::SentPacketHistory(int size)
|
||||
: _sentPackets(size),
|
||||
_newestSequenceNumber(std::numeric_limits<uint16_t>::max())
|
||||
|
@ -24,7 +28,7 @@ void SentPacketHistory::packetSent(uint16_t sequenceNumber, const QByteArray& pa
|
|||
// the code calling this function
|
||||
uint16_t expectedSequenceNumber = _newestSequenceNumber + (uint16_t)1;
|
||||
if (sequenceNumber != expectedSequenceNumber) {
|
||||
qDebug() << "Unexpected sequence number passed to SentPacketHistory::packetSent()!"
|
||||
qCDebug(networking) << "Unexpected sequence number passed to SentPacketHistory::packetSent()!"
|
||||
<< "Expected:" << expectedSequenceNumber << "Actual:" << sequenceNumber;
|
||||
}
|
||||
_newestSequenceNumber = sequenceNumber;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
//
|
||||
|
||||
#include "SequenceNumberStats.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
|
@ -42,8 +43,8 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
// if the sender node has changed, reset all stats
|
||||
if (senderUUID != _lastSenderUUID) {
|
||||
if (_stats._received > 0) {
|
||||
qDebug() << "sequence number stats was reset due to new sender node";
|
||||
qDebug() << "previous:" << _lastSenderUUID << "current:" << senderUUID;
|
||||
qCDebug(networking) << "sequence number stats was reset due to new sender node";
|
||||
qCDebug(networking) << "previous:" << _lastSenderUUID << "current:" << senderUUID;
|
||||
reset();
|
||||
}
|
||||
_lastSenderUUID = senderUUID;
|
||||
|
@ -61,7 +62,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
} else { // out of order
|
||||
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "out of order... got:" << incoming << "expected:" << expected;
|
||||
qCDebug(networking) << "out of order... got:" << incoming << "expected:" << expected;
|
||||
}
|
||||
|
||||
int incomingInt = (int)incoming;
|
||||
|
@ -80,7 +81,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
} else if (absGap > MAX_REASONABLE_SEQUENCE_GAP) {
|
||||
arrivalInfo._status = Unreasonable;
|
||||
|
||||
qDebug() << "unreasonable sequence number:" << incoming << "previous:" << _lastReceivedSequence;
|
||||
qCDebug(networking) << "unreasonable sequence number:" << incoming << "previous:" << _lastReceivedSequence;
|
||||
|
||||
_stats._unreasonable++;
|
||||
|
||||
|
@ -98,8 +99,8 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
arrivalInfo._status = Early;
|
||||
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "this packet is earlier than expected...";
|
||||
qDebug() << ">>>>>>>> missing gap=" << (incomingInt - expectedInt);
|
||||
qCDebug(networking) << "this packet is earlier than expected...";
|
||||
qCDebug(networking) << ">>>>>>>> missing gap=" << (incomingInt - expectedInt);
|
||||
}
|
||||
int skipped = incomingInt - expectedInt;
|
||||
_stats._early++;
|
||||
|
@ -119,7 +120,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
}
|
||||
} else { // late
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "this packet is later than expected...";
|
||||
qCDebug(networking) << "this packet is later than expected...";
|
||||
}
|
||||
|
||||
_stats._late++;
|
||||
|
@ -131,7 +132,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
arrivalInfo._status = Recovered;
|
||||
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "found it in _missingSet";
|
||||
qCDebug(networking) << "found it in _missingSet";
|
||||
}
|
||||
_stats._lost--;
|
||||
_stats._recovered++;
|
||||
|
@ -142,7 +143,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
|||
|
||||
arrivalInfo._status = Unreasonable;
|
||||
|
||||
qDebug() << "unreasonable sequence number:" << incoming << "(possible duplicate)";
|
||||
qCDebug(networking) << "unreasonable sequence number:" << incoming << "(possible duplicate)";
|
||||
|
||||
_stats._unreasonable++;
|
||||
|
||||
|
@ -185,7 +186,7 @@ void SequenceNumberStats::receivedUnreasonable(quint16 incoming) {
|
|||
_statsHistory.clear();
|
||||
_consecutiveUnreasonableOnTime = 0;
|
||||
|
||||
qDebug() << "re-synced with sequence number sender";
|
||||
qCDebug(networking) << "re-synced with sequence number sender";
|
||||
}
|
||||
} else {
|
||||
_consecutiveUnreasonableOnTime = 0;
|
||||
|
@ -194,7 +195,7 @@ void SequenceNumberStats::receivedUnreasonable(quint16 incoming) {
|
|||
|
||||
void SequenceNumberStats::pruneMissingSet(const bool wantExtraDebugging) {
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "pruning _missingSet! size:" << _missingSet.size();
|
||||
qCDebug(networking) << "pruning _missingSet! size:" << _missingSet.size();
|
||||
}
|
||||
|
||||
// some older sequence numbers may be from before a rollover point; this must be handled.
|
||||
|
@ -207,14 +208,14 @@ void SequenceNumberStats::pruneMissingSet(const bool wantExtraDebugging) {
|
|||
while (i != _missingSet.end()) {
|
||||
quint16 missing = *i;
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "checking item:" << missing << "is it in need of pruning?";
|
||||
qDebug() << "old age cutoff:" << nonRolloverCutoff;
|
||||
qCDebug(networking) << "checking item:" << missing << "is it in need of pruning?";
|
||||
qCDebug(networking) << "old age cutoff:" << nonRolloverCutoff;
|
||||
}
|
||||
|
||||
if (missing > _lastReceivedSequence || missing < nonRolloverCutoff) {
|
||||
i = _missingSet.erase(i);
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "pruning really old missing sequence:" << missing;
|
||||
qCDebug(networking) << "pruning really old missing sequence:" << missing;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
|
@ -226,14 +227,14 @@ void SequenceNumberStats::pruneMissingSet(const bool wantExtraDebugging) {
|
|||
while (i != _missingSet.end()) {
|
||||
quint16 missing = *i;
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "checking item:" << missing << "is it in need of pruning?";
|
||||
qDebug() << "old age cutoff:" << rolloverCutoff;
|
||||
qCDebug(networking) << "checking item:" << missing << "is it in need of pruning?";
|
||||
qCDebug(networking) << "old age cutoff:" << rolloverCutoff;
|
||||
}
|
||||
|
||||
if (missing > _lastReceivedSequence && missing < rolloverCutoff) {
|
||||
i = _missingSet.erase(i);
|
||||
if (wantExtraDebugging) {
|
||||
qDebug() << "pruning really old missing sequence:" << missing;
|
||||
qCDebug(networking) << "pruning really old missing sequence:" << missing;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <QHttpMultiPart>
|
||||
#include <QTimer>
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
static const QString USER_ACTIVITY_URL = "/api/v1/user_activities";
|
||||
|
@ -52,7 +54,7 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
|||
detailsPart.setBody(QJsonDocument(details).toJson(QJsonDocument::Compact));
|
||||
multipart->append(detailsPart);
|
||||
}
|
||||
qDebug() << "Logging activity" << action;
|
||||
qCDebug(networking) << "Logging activity" << action;
|
||||
|
||||
// if no callbacks specified, call our owns
|
||||
if (params.isEmpty()) {
|
||||
|
@ -69,11 +71,11 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
|||
}
|
||||
|
||||
void UserActivityLogger::requestFinished(QNetworkReply& requestReply) {
|
||||
// qDebug() << object;
|
||||
// qCDebug(networking) << object;
|
||||
}
|
||||
|
||||
void UserActivityLogger::requestError(QNetworkReply& errorReply) {
|
||||
qDebug() << errorReply.error() << "-" << errorReply.errorString();
|
||||
qCDebug(networking) << errorReply.error() << "-" << errorReply.errorString();
|
||||
}
|
||||
|
||||
void UserActivityLogger::launch(QString applicationVersion) {
|
||||
|
|
Loading…
Reference in a new issue