mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:16:58 +02:00
if hifi uri is localhost, extract domain-server port from shared memory
This commit is contained in:
parent
1a4808857e
commit
af341f0ee5
2 changed files with 14 additions and 3 deletions
|
@ -34,7 +34,8 @@ AddressManager::AddressManager() :
|
||||||
_rootPlaceName(),
|
_rootPlaceName(),
|
||||||
_rootPlaceID(),
|
_rootPlaceID(),
|
||||||
_positionGetter(NULL),
|
_positionGetter(NULL),
|
||||||
_orientationGetter(NULL)
|
_orientationGetter(NULL),
|
||||||
|
_localDSPortSharedMem(NULL)
|
||||||
{
|
{
|
||||||
connect(qApp, &QCoreApplication::aboutToQuit, this, &AddressManager::storeCurrentAddress);
|
connect(qApp, &QCoreApplication::aboutToQuit, this, &AddressManager::storeCurrentAddress);
|
||||||
}
|
}
|
||||||
|
@ -152,8 +153,15 @@ void AddressManager::handleLookupString(const QString& lookupString) {
|
||||||
if (!lookupString.startsWith('/')) {
|
if (!lookupString.startsWith('/')) {
|
||||||
const QRegExp HIFI_SCHEME_REGEX = QRegExp(HIFI_URL_SCHEME + ":\\/{1,2}", Qt::CaseInsensitive);
|
const QRegExp HIFI_SCHEME_REGEX = QRegExp(HIFI_URL_SCHEME + ":\\/{1,2}", Qt::CaseInsensitive);
|
||||||
sanitizedString = sanitizedString.remove(HIFI_SCHEME_REGEX);
|
sanitizedString = sanitizedString.remove(HIFI_SCHEME_REGEX);
|
||||||
|
|
||||||
|
quint16 localDomainServerPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||||
|
if (sanitizedString == "localhost") {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
nodeList->getLocalServerPortFromSharedMemory
|
||||||
|
(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localDSPortSharedMem, localDomainServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
lookupURL = QUrl(HIFI_URL_SCHEME + "://" + sanitizedString);
|
lookupURL = QUrl(HIFI_URL_SCHEME + "://" + sanitizedString + ":" + QString::number(localDomainServerPort));
|
||||||
} else {
|
} else {
|
||||||
lookupURL = QUrl(lookupString);
|
lookupURL = QUrl(lookupString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define hifi_AddressManager_h
|
#define hifi_AddressManager_h
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
@ -94,6 +95,8 @@ private:
|
||||||
QUuid _rootPlaceID;
|
QUuid _rootPlaceID;
|
||||||
PositionGetter _positionGetter;
|
PositionGetter _positionGetter;
|
||||||
OrientationGetter _orientationGetter;
|
OrientationGetter _orientationGetter;
|
||||||
|
|
||||||
|
QSharedMemory* _localDSPortSharedMem; // memory shared with domain server
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AddressManager_h
|
#endif // hifi_AddressManager_h
|
||||||
|
|
Loading…
Reference in a new issue