From 92e9e6a3fa35879cd7282920d4a7f6f0f89ef70a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 30 Mar 2016 11:35:41 -0700 Subject: [PATCH] use the NetworkAccessManager to get a single QNetworkAccessManager --- ice-server/src/IceServer.cpp | 10 +++++----- ice-server/src/IceServer.h | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ice-server/src/IceServer.cpp b/ice-server/src/IceServer.cpp index ac5952ce43..7bd8306e9b 100644 --- a/ice-server/src/IceServer.cpp +++ b/ice-server/src/IceServer.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -33,8 +34,7 @@ IceServer::IceServer(int argc, char* argv[]) : _id(QUuid::createUuid()), _serverSocket(), _activePeers(), - _httpManager(QHostAddress::AnyIPv4, ICE_SERVER_MONITORING_PORT, QString("%1/web/").arg(QCoreApplication::applicationDirPath()), this), - _networkAccessManager(this) + _httpManager(QHostAddress::AnyIPv4, ICE_SERVER_MONITORING_PORT, QString("%1/web/").arg(QCoreApplication::applicationDirPath()), this) { // start the ice-server socket qDebug() << "ice-server socket is listening on" << ICE_SERVER_DEFAULT_PORT; @@ -202,8 +202,8 @@ bool IceServer::isVerifiedHeartbeat(const QUuid& domainID, const QByteArray& pla void IceServer::requestDomainPublicKey(const QUuid& domainID) { // send a request to the metaverse API for the public key for this domain - - connect(&_networkAccessManager, &QNetworkAccessManager::finished, this, &IceServer::publicKeyReplyFinished); + auto& networkAccessManager = NetworkAccessManager::getInstance(); + connect(&networkAccessManager, &QNetworkAccessManager::finished, this, &IceServer::publicKeyReplyFinished); QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL }; QString publicKeyPath = QString("/api/v1/domains/%1/public_key").arg(uuidStringWithoutCurlyBraces(domainID)); @@ -214,7 +214,7 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) { qDebug() << "Requesting public key for domain with ID" << domainID; - _networkAccessManager.get(publicKeyRequest); + networkAccessManager.get(publicKeyRequest); } void IceServer::publicKeyReplyFinished(QNetworkReply* reply) { diff --git a/ice-server/src/IceServer.h b/ice-server/src/IceServer.h index 2f9ee9c727..6cc33fd8fc 100644 --- a/ice-server/src/IceServer.h +++ b/ice-server/src/IceServer.h @@ -54,8 +54,6 @@ private: HTTPManager _httpManager; - QNetworkAccessManager _networkAccessManager; - using RSAUniquePtr = std::unique_ptr>; using DomainPublicKeyHash = std::unordered_map; DomainPublicKeyHash _domainPublicKeys;