History

'disconnect' from serverless domain when transitioning from a serverless-domain to a DNS name (rather than a place name)

Seth Alves committed 8 years ago

Commit bd10cd61 parent f61504b2 files · +16 −6Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+15−6
@@ -3118,6 +3118,9 @@ bool Application::isServerlessMode() const { · 3117 unmodified lines
3118 3118
3119void Application::setIsServerlessDomain(bool serverlessDomain) {3119void Application::setIsServerlessDomain(bool serverlessDomain) {
3120 auto tree = getEntities()->getTree();3120 auto tree = getEntities()->getTree();
3121 if (tree->isServerlessMode() && !serverlessDomain) {
3122 disconnectFromDomain();
3123 }
3121 if (tree) {3124 if (tree) {
3122 tree->setIsServerlessMode(serverlessDomain);3125 tree->setIsServerlessMode(serverlessDomain);
3123 }3126 }
@@ -3129,12 +3132,7 @@ void Application::loadServerlessDomain(QUrl domainURL) { · 5 unmodified lines
3129 return;3132 return;
3130 }3133 }
3131 3134
3132 auto nodeList = DependencyManager::get<NodeList>();3135 disconnectFromDomain();
3133 clearDomainOctreeDetails();
3134 getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
3135 NodePermissions permissions; // deny all permissions
3136 permissions.setAll(false);
3137 nodeList->setPermissions(permissions);
3138 3136
3139 if (domainURL.isEmpty()) {3137 if (domainURL.isEmpty()) {
3140 return;3138 return;
@@ -3142,9 +3140,11 @@ void Application::loadServerlessDomain(QUrl domainURL) { · 1 unmodified line
3142 3140
3143 QUuid serverlessSessionID = QUuid::createUuid();3141 QUuid serverlessSessionID = QUuid::createUuid();
3144 getMyAvatar()->setSessionUUID(serverlessSessionID);3142 getMyAvatar()->setSessionUUID(serverlessSessionID);
3143 auto nodeList = DependencyManager::get<NodeList>();
3145 nodeList->setSessionUUID(serverlessSessionID);3144 nodeList->setSessionUUID(serverlessSessionID);
3146 3145
3147 // there is no domain-server to tell us our permissions, so enable all3146 // there is no domain-server to tell us our permissions, so enable all
3147 NodePermissions permissions;
3148 permissions.setAll(true);3148 permissions.setAll(true);
3149 nodeList->setPermissions(permissions);3149 nodeList->setPermissions(permissions);
3150 3150
@@ -3164,6 +3164,15 @@ void Application::loadServerlessDomain(QUrl domainURL) { · 13 unmodified lines
3164 _fullSceneReceivedCounter++;3164 _fullSceneReceivedCounter++;
3165}3165}
3166 3166
3167void Application::disconnectFromDomain() {
3168 auto nodeList = DependencyManager::get<NodeList>();
3169 clearDomainOctreeDetails();
3170 getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
3171 NodePermissions permissions; // deny all permissions
3172 permissions.setAll(false);
3173 nodeList->setPermissions(permissions);
3174}
3175
3167bool Application::importImage(const QString& urlString) {3176bool Application::importImage(const QString& urlString) {
3168 qCDebug(interfaceapp) << "An image file has been dropped in";3177 qCDebug(interfaceapp) << "An image file has been dropped in";
3169 QString filepath(urlString);3178 QString filepath(urlString);