diff --git a/ice-server/src/IceServer.cpp b/ice-server/src/IceServer.cpp index 2d52f9fc82..ac5952ce43 100644 --- a/ice-server/src/IceServer.cpp +++ b/ice-server/src/IceServer.cpp @@ -33,7 +33,8 @@ 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) + _httpManager(QHostAddress::AnyIPv4, ICE_SERVER_MONITORING_PORT, QString("%1/web/").arg(QCoreApplication::applicationDirPath()), this), + _networkAccessManager(this) { // start the ice-server socket qDebug() << "ice-server socket is listening on" << ICE_SERVER_DEFAULT_PORT; @@ -201,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 - QNetworkAccessManager* manager = new QNetworkAccessManager { this }; - connect(manager, &QNetworkAccessManager::finished, this, &IceServer::publicKeyReplyFinished); + + 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)); @@ -213,7 +214,7 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) { qDebug() << "Requesting public key for domain with ID" << domainID; - manager->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 6cc33fd8fc..2f9ee9c727 100644 --- a/ice-server/src/IceServer.h +++ b/ice-server/src/IceServer.h @@ -54,6 +54,8 @@ private: HTTPManager _httpManager; + QNetworkAccessManager _networkAccessManager; + using RSAUniquePtr = std::unique_ptr>; using DomainPublicKeyHash = std::unordered_map; DomainPublicKeyHash _domainPublicKeys;