mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
use one QNetworkAccessManager for the ice-server
This commit is contained in:
parent
24acf7584a
commit
1771875186
2 changed files with 7 additions and 4 deletions
|
@ -33,7 +33,8 @@ IceServer::IceServer(int argc, char* argv[]) :
|
||||||
_id(QUuid::createUuid()),
|
_id(QUuid::createUuid()),
|
||||||
_serverSocket(),
|
_serverSocket(),
|
||||||
_activePeers(),
|
_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
|
// start the ice-server socket
|
||||||
qDebug() << "ice-server socket is listening on" << ICE_SERVER_DEFAULT_PORT;
|
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) {
|
void IceServer::requestDomainPublicKey(const QUuid& domainID) {
|
||||||
// send a request to the metaverse API for the public key for this domain
|
// 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 };
|
QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL };
|
||||||
QString publicKeyPath = QString("/api/v1/domains/%1/public_key").arg(uuidStringWithoutCurlyBraces(domainID));
|
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;
|
qDebug() << "Requesting public key for domain with ID" << domainID;
|
||||||
|
|
||||||
manager->get(publicKeyRequest);
|
_networkAccessManager.get(publicKeyRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IceServer::publicKeyReplyFinished(QNetworkReply* reply) {
|
void IceServer::publicKeyReplyFinished(QNetworkReply* reply) {
|
||||||
|
|
|
@ -54,6 +54,8 @@ private:
|
||||||
|
|
||||||
HTTPManager _httpManager;
|
HTTPManager _httpManager;
|
||||||
|
|
||||||
|
QNetworkAccessManager _networkAccessManager;
|
||||||
|
|
||||||
using RSAUniquePtr = std::unique_ptr<RSA, std::function<void(RSA*)>>;
|
using RSAUniquePtr = std::unique_ptr<RSA, std::function<void(RSA*)>>;
|
||||||
using DomainPublicKeyHash = std::unordered_map<QUuid, RSAUniquePtr>;
|
using DomainPublicKeyHash = std::unordered_map<QUuid, RSAUniquePtr>;
|
||||||
DomainPublicKeyHash _domainPublicKeys;
|
DomainPublicKeyHash _domainPublicKeys;
|
||||||
|
|
Loading…
Reference in a new issue