History

Add user warning if domain has mismatched packet versions

David Rowe committed 11 years ago

Commit 44083dd1 parent 4c10f6f6 files · +35 −4Browse files

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

Unified · Split

interface/src/Application.cpp+21−3
@@ -221,7 +221,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 220 unmodified lines
221221 _lastNackTime(usecTimestampNow()),
222222 _lastSendDownstreamAudioStats(usecTimestampNow()),
223223 _isVSyncOn(true),
224− _aboutToQuit(false)
224+ _aboutToQuit(false),
225+ _notifiedPacketVersionMismatchThisDomain(false)
225226 {
226227 auto glCanvas = DependencyManager::get<GLCanvas>();
227228 auto nodeList = DependencyManager::get<NodeList>();
@@ -305,6 +306,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 77 unmodified lines
305306 connect(nodeList.data(), SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
306307 connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID);
307308 connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
309+ connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
308310
309311 // connect to appropriate slots on AccountManager
310312 AccountManager& accountManager = AccountManager::getInstance();
@@ -576,6 +578,7 @@ void Application::initializeGL() { · 265 unmodified lines
576578
577579 // create thread for parsing of octee data independent of the main network and rendering threads
578580 _octreeProcessor.initialize(_enableProcessOctreeThread);
581+ connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
579582 _entityEditSender.initialize(_enableProcessOctreeThread);
580583
581584 // call our timer function every second
@@ -3218,11 +3221,11 @@ void Application::connectedToDomain(const QString& hostname) { · 2636 unmodified lines
32183221
32193222 if (accountManager.isLoggedIn() && !domainID.isNull()) {
32203223 // update our data-server with the domain-server we're logged in with
3221−
32223224 QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}";
3223−
32243225 accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation,
32253226 JSONCallbackParameters(), domainPutJsonString.toUtf8());
3227+
3228+ _notifiedPacketVersionMismatchThisDomain = false;
32263229 }
32273230 }
32283231
@@ -3988,3 +3991,18 @@ int Application::getRenderAmbientLight() const { · 759 unmodified lines
39883991 return -1;
39893992 }
39903993 }
3994+
3995+void Application::notifyPacketVersionMismatch() {
3996+ if (!_notifiedPacketVersionMismatchThisDomain) {
3997+ _notifiedPacketVersionMismatchThisDomain = true;
3998+
3999+ QString message = "The location you are visiting is running an incompatible server version.\n";
4000+ message += "Content may not display properly.";
4001+
4002+ QMessageBox msgBox;
4003+ msgBox.setText(message);
4004+ msgBox.setStandardButtons(QMessageBox::Ok);
4005+ msgBox.setIcon(QMessageBox::Warning);
4006+ msgBox.exec();
4007+ }
4008+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t