mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 06:53:59 +02:00
Merge pull request #11 from sethalves/serverless-domain-named-paths
code review
This commit is contained in:
commit
e839a15f03
4 changed files with 24 additions and 10 deletions
|
@ -3147,7 +3147,8 @@ void Application::loadServerlessDomain(QUrl domainURL) {
|
|||
}
|
||||
|
||||
std::map<QString, QString> namedPaths = tmpTree->getNamedPaths();
|
||||
nodeList->getDomainHandler().setIsConnected(true, namedPaths);
|
||||
nodeList->getDomainHandler().connectedToServerless(namedPaths);
|
||||
|
||||
|
||||
_fullSceneReceivedCounter++;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "UserActivityLogger.h"
|
||||
#include "udt/PacketHeaders.h"
|
||||
|
||||
const QString DEFAULT_HIFI_ADDRESS = "file:///~/serverless/tutorial.json?location=/";
|
||||
const QString DEFAULT_HIFI_ADDRESS = "file:///~/serverless/tutorial.json";
|
||||
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
||||
const QString SETTINGS_CURRENT_ADDRESS_KEY = "address";
|
||||
|
||||
|
@ -318,6 +318,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
const QString LOCATION_QUERY_KEY = "location";
|
||||
if (queryArgs.hasQueryItem(LOCATION_QUERY_KEY)) {
|
||||
path = queryArgs.queryItemValue(LOCATION_QUERY_KEY);
|
||||
} else {
|
||||
path = DEFAULT_NAMED_PATH;
|
||||
}
|
||||
|
||||
handlePath(path, LookupTrigger::Internal, false);
|
||||
|
|
|
@ -177,9 +177,11 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
|
|||
qCDebug(networking) << "Updated domain hostname to" << domainURL.host();
|
||||
|
||||
if (!domainURL.host().isEmpty()) {
|
||||
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
|
||||
qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData());
|
||||
QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||
if (domainURL.scheme() == URL_SCHEME_HIFI) {
|
||||
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
|
||||
qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData());
|
||||
QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||
}
|
||||
|
||||
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(
|
||||
LimitedNodeList::ConnectionStep::SetDomainHostname);
|
||||
|
@ -253,7 +255,10 @@ QString DomainHandler::getViewPointFromNamedPath(QString namedPath) {
|
|||
if (lookup != _namedPaths.end()) {
|
||||
return lookup->second;
|
||||
}
|
||||
return DOMAIN_SPAWNING_POINT;
|
||||
if (namedPath == DEFAULT_NAMED_PATH) {
|
||||
return DOMAIN_SPAWNING_POINT;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void DomainHandler::completedHostnameLookup(const QHostInfo& hostInfo) {
|
||||
|
@ -285,8 +290,7 @@ void DomainHandler::completedIceServerHostnameLookup() {
|
|||
emit iceSocketAndIDReceived();
|
||||
}
|
||||
|
||||
void DomainHandler::setIsConnected(bool isConnected, std::map<QString, QString> namedPaths) {
|
||||
_namedPaths = namedPaths;
|
||||
void DomainHandler::setIsConnected(bool isConnected) {
|
||||
if (_isConnected != isConnected) {
|
||||
_isConnected = isConnected;
|
||||
|
||||
|
@ -304,6 +308,11 @@ void DomainHandler::setIsConnected(bool isConnected, std::map<QString, QString>
|
|||
}
|
||||
}
|
||||
|
||||
void DomainHandler::connectedToServerless(std::map<QString, QString> namedPaths) {
|
||||
_namedPaths = namedPaths;
|
||||
setIsConnected(true);
|
||||
}
|
||||
|
||||
void DomainHandler::requestDomainSettings() {
|
||||
qCDebug(networking) << "Requesting settings from domain server";
|
||||
|
||||
|
|
|
@ -73,9 +73,11 @@ public:
|
|||
void activateICEPublicSocket();
|
||||
|
||||
bool isConnected() const { return _isConnected; }
|
||||
void setIsConnected(bool isConnected, std::map<QString, QString> namedPaths = std::map<QString, QString>());
|
||||
void setIsConnected(bool isConnected);
|
||||
bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_HIFI; }
|
||||
|
||||
void connectedToServerless(std::map<QString, QString> namedPaths);
|
||||
|
||||
QString getViewPointFromNamedPath(QString namedPath);
|
||||
|
||||
bool hasSettings() const { return !_settingsObject.isEmpty(); }
|
||||
|
@ -207,6 +209,6 @@ private:
|
|||
};
|
||||
|
||||
const QString DOMAIN_SPAWNING_POINT { "/0, -10, 0" };
|
||||
|
||||
const QString DEFAULT_NAMED_PATH { "/" };
|
||||
|
||||
#endif // hifi_DomainHandler_h
|
||||
|
|
Loading…
Reference in a new issue