From 62041d91a8682fd25dd14710b0b593f0b97177fe Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 1 Apr 2014 13:09:35 -0700 Subject: [PATCH] rename NodeList DomainInfo to DomainHandler --- animation-server/src/AnimationServer.cpp | 4 +-- assignment-client/src/Agent.cpp | 2 +- assignment-client/src/AssignmentClient.cpp | 6 ++--- interface/src/Application.cpp | 6 ++--- interface/src/Menu.cpp | 12 ++++----- interface/src/avatar/MyAvatar.cpp | 2 +- interface/src/ui/Snapshot.cpp | 2 +- .../src/{DomainInfo.cpp => DomainHandler.cpp} | 24 ++++++++--------- .../src/{DomainInfo.h => DomainHandler.h} | 14 +++++----- libraries/shared/src/NodeList.cpp | 26 +++++++++---------- libraries/shared/src/NodeList.h | 6 ++--- 11 files changed, 52 insertions(+), 52 deletions(-) rename libraries/shared/src/{DomainInfo.cpp => DomainHandler.cpp} (85%) rename libraries/shared/src/{DomainInfo.h => DomainHandler.h} (90%) diff --git a/animation-server/src/AnimationServer.cpp b/animation-server/src/AnimationServer.cpp index 1f0828ec17..e66ca35501 100644 --- a/animation-server/src/AnimationServer.cpp +++ b/animation-server/src/AnimationServer.cpp @@ -723,12 +723,12 @@ AnimationServer::AnimationServer(int &argc, char **argv) : ::wantLocalDomain = cmdOptionExists(argc, (const char**) argv,local); if (::wantLocalDomain) { printf("Local Domain MODE!\n"); - nodeList->getDomainInfo().setIPToLocalhost(); + nodeList->getDomainHandler().setIPToLocalhost(); } const char* domainHostname = getCmdOption(argc, (const char**) argv, "--domain"); if (domainHostname) { - NodeList::getInstance()->getDomainInfo().setHostname(domainHostname); + NodeList::getInstance()->getDomainHandler().setHostname(domainHostname); } const char* packetsPerSecondCommand = getCmdOption(argc, (const char**) argv, "--pps"); diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index b5199e87e8..4203ec02dc 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -146,7 +146,7 @@ void Agent::run() { // figure out the URL for the script for this agent assignment QString scriptURLString("http://%1:8080/assignment/%2"); - scriptURLString = scriptURLString.arg(NodeList::getInstance()->getDomainInfo().getIP().toString(), + scriptURLString = scriptURLString.arg(NodeList::getInstance()->getDomainHandler().getIP().toString(), uuidStringWithoutCurlyBraces(_uuid)); QNetworkAccessManager *networkManager = new QNetworkAccessManager(this); diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 7da87e4e5d..046f362e1e 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -136,10 +136,10 @@ void AssignmentClient::readPendingDatagrams() { // switch our nodelist domain IP and port to whoever sent us the assignment - nodeList->getDomainInfo().setSockAddr(senderSockAddr); - nodeList->getDomainInfo().setAssignmentUUID(_currentAssignment->getUUID()); + nodeList->getDomainHandler().setSockAddr(senderSockAddr); + nodeList->getDomainHandler().setAssignmentUUID(_currentAssignment->getUUID()); - qDebug() << "Destination IP for assignment is" << nodeList->getDomainInfo().getIP().toString(); + qDebug() << "Destination IP for assignment is" << nodeList->getDomainHandler().getIP().toString(); // start the deployed assignment AssignmentThread* workerThread = new AssignmentThread(_currentAssignment, this); diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c6fc522fca..4ffdf5b2b7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -228,8 +228,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : audioThread->start(); - connect(&nodeList->getDomainInfo(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); - connect(&nodeList->getDomainInfo(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&))); + connect(&nodeList->getDomainHandler(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); + connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&))); connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded); connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled); @@ -3279,7 +3279,7 @@ void Application::updateWindowTitle(){ QString username = AccountManager::getInstance().getUsername(); QString title = QString() + (!username.isEmpty() ? username + " " : QString()) + nodeList->getSessionUUID().toString() - + " @ " + nodeList->getDomainInfo().getHostname() + buildVersion; + + " @ " + nodeList->getDomainHandler().getHostname() + buildVersion; qDebug("Application title set to: %s", title.toStdString().c_str()); _window->setWindowTitle(title); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 7748c466c7..ebb817deb3 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -863,23 +863,23 @@ void Menu::editPreferences() { } void Menu::goToDomain(const QString newDomain) { - if (NodeList::getInstance()->getDomainInfo().getHostname() != newDomain) { + if (NodeList::getInstance()->getDomainHandler().getHostname() != newDomain) { // send a node kill request, indicating to other clients that they should play the "disappeared" effect Application::getInstance()->getAvatar()->sendKillAvatar(); // give our nodeList the new domain-server hostname - NodeList::getInstance()->getDomainInfo().setHostname(newDomain); + NodeList::getInstance()->getDomainHandler().setHostname(newDomain); } } void Menu::goToDomainDialog() { - QString currentDomainHostname = NodeList::getInstance()->getDomainInfo().getHostname(); + QString currentDomainHostname = NodeList::getInstance()->getDomainHandler().getHostname(); - if (NodeList::getInstance()->getDomainInfo().getPort() != DEFAULT_DOMAIN_SERVER_PORT) { + if (NodeList::getInstance()->getDomainHandler().getPort() != DEFAULT_DOMAIN_SERVER_PORT) { // add the port to the currentDomainHostname string if it is custom - currentDomainHostname.append(QString(":%1").arg(NodeList::getInstance()->getDomainInfo().getPort())); + currentDomainHostname.append(QString(":%1").arg(NodeList::getInstance()->getDomainHandler().getPort())); } QInputDialog domainDialog(Application::getInstance()->getWindow()); @@ -1034,7 +1034,7 @@ void Menu::nameLocation() { connect(manager, &LocationManager::creationCompleted, this, &Menu::namedLocationCreated); NamedLocation* location = new NamedLocation(locationName, myAvatar->getPosition(), myAvatar->getOrientation(), - NodeList::getInstance()->getDomainInfo().getHostname()); + NodeList::getInstance()->getDomainHandler().getHostname()); manager->createNamedLocation(location); } } diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 62ba24a384..4fadd98cdd 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1129,7 +1129,7 @@ void MyAvatar::goToLocationFromResponse(const QJsonObject& jsonObject) { QStringList coordinateItems = positionString.split(','); QStringList orientationItems = orientationString.split(','); - NodeList::getInstance()->getDomainInfo().setHostname(domainHostnameString); + NodeList::getInstance()->getDomainHandler().setHostname(domainHostnameString); // orient the user to face the target glm::quat newOrientation = glm::quat(glm::radians(glm::vec3(orientationItems[0].toFloat(), diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index a29a96f009..dec69498ed 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -76,7 +76,7 @@ void Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) { shot.setText(ORIENTATION_Z, QString::number(orientation.z)); shot.setText(ORIENTATION_W, QString::number(orientation.w)); - shot.setText(DOMAIN_KEY, NodeList::getInstance()->getDomainInfo().getHostname()); + shot.setText(DOMAIN_KEY, NodeList::getInstance()->getDomainHandler().getHostname()); QString formattedLocation = QString("%1_%2_%3").arg(location.x).arg(location.y).arg(location.z); // replace decimal . with '-' diff --git a/libraries/shared/src/DomainInfo.cpp b/libraries/shared/src/DomainHandler.cpp similarity index 85% rename from libraries/shared/src/DomainInfo.cpp rename to libraries/shared/src/DomainHandler.cpp index 1a360d1150..52bfa04414 100644 --- a/libraries/shared/src/DomainInfo.cpp +++ b/libraries/shared/src/DomainHandler.cpp @@ -1,5 +1,5 @@ // -// DomainInfo.cpp +// DomainHandler.cpp // hifi // // Created by Stephen Birarda on 2/18/2014. @@ -11,9 +11,9 @@ #include "NodeList.h" #include "PacketHeaders.h" -#include "DomainInfo.h" +#include "DomainHandler.h" -DomainInfo::DomainInfo() : +DomainHandler::DomainHandler() : _uuid(), _sockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)), _assignmentUUID(), @@ -24,29 +24,29 @@ DomainInfo::DomainInfo() : } -DomainInfo::~DomainInfo() { +DomainHandler::~DomainHandler() { delete _dtlsSession; } -void DomainInfo::clearConnectionInfo() { +void DomainHandler::clearConnectionInfo() { _uuid = QUuid(); _isConnected = false; } -void DomainInfo::reset() { +void DomainHandler::reset() { clearConnectionInfo(); _hostname = QString(); _sockAddr.setAddress(QHostAddress::Null); _requiresDTLS = false; } -void DomainInfo::initializeDTLSSession() { +void DomainHandler::initializeDTLSSession() { if (!_dtlsSession) { _dtlsSession = new DTLSSession(NodeList::getInstance()->getDTLSSocket()); } } -void DomainInfo::setSockAddr(const HifiSockAddr& sockAddr) { +void DomainHandler::setSockAddr(const HifiSockAddr& sockAddr) { if (_sockAddr != sockAddr) { // we should reset on a sockAddr change reset(); @@ -55,7 +55,7 @@ void DomainInfo::setSockAddr(const HifiSockAddr& sockAddr) { } } -void DomainInfo::setHostname(const QString& hostname) { +void DomainHandler::setHostname(const QString& hostname) { if (hostname != _hostname) { // re-set the domain info so that auth information is reloaded @@ -88,7 +88,7 @@ void DomainInfo::setHostname(const QString& hostname) { } } -void DomainInfo::completedHostnameLookup(const QHostInfo& hostInfo) { +void DomainHandler::completedHostnameLookup(const QHostInfo& hostInfo) { for (int i = 0; i < hostInfo.addresses().size(); i++) { if (hostInfo.addresses()[i].protocol() == QAbstractSocket::IPv4Protocol) { _sockAddr.setAddress(hostInfo.addresses()[i]); @@ -102,7 +102,7 @@ void DomainInfo::completedHostnameLookup(const QHostInfo& hostInfo) { qDebug("Failed domain server lookup"); } -void DomainInfo::setIsConnected(bool isConnected) { +void DomainHandler::setIsConnected(bool isConnected) { if (_isConnected != isConnected) { _isConnected = isConnected; @@ -112,7 +112,7 @@ void DomainInfo::setIsConnected(bool isConnected) { } } -void DomainInfo::parseDTLSRequirementPacket(const QByteArray& dtlsRequirementPacket) { +void DomainHandler::parseDTLSRequirementPacket(const QByteArray& dtlsRequirementPacket) { // figure out the port that the DS wants us to use for us to talk to them with DTLS int numBytesPacketHeader = numBytesForPacketHeader(dtlsRequirementPacket); diff --git a/libraries/shared/src/DomainInfo.h b/libraries/shared/src/DomainHandler.h similarity index 90% rename from libraries/shared/src/DomainInfo.h rename to libraries/shared/src/DomainHandler.h index 71a0caabe0..4a9f166963 100644 --- a/libraries/shared/src/DomainInfo.h +++ b/libraries/shared/src/DomainHandler.h @@ -1,13 +1,13 @@ // -// DomainInfo.h +// DomainHandler.h // hifi // // Created by Stephen Birarda on 2/18/2014. // Copyright (c) 2014 HighFidelity, Inc. All rights reserved. // -#ifndef __hifi__DomainInfo__ -#define __hifi__DomainInfo__ +#ifndef __hifi__DomainHandler__ +#define __hifi__DomainHandler__ #include #include @@ -21,11 +21,11 @@ const QString DEFAULT_DOMAIN_HOSTNAME = "alpha.highfidelity.io"; const unsigned short DEFAULT_DOMAIN_SERVER_PORT = 40102; const unsigned short DEFAULT_DOMAIN_SERVER_DTLS_PORT = 40103; -class DomainInfo : public QObject { +class DomainHandler : public QObject { Q_OBJECT public: - DomainInfo(); - ~DomainInfo(); + DomainHandler(); + ~DomainHandler(); void clearConnectionInfo(); @@ -70,4 +70,4 @@ private: DTLSSession* _dtlsSession; }; -#endif /* defined(__hifi__DomainInfo__) */ +#endif /* defined(__hifi__DomainHandler__) */ diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 56986b4cc8..7cf58385fe 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -87,7 +87,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned } // clear our NodeList when the domain changes - connect(&_domainInfo, &DomainInfo::hostnameChanged, this, &NodeList::reset); + connect(&_DomainHandler, &DomainHandler::hostnameChanged, this, &NodeList::reset); // clear our NodeList when logout is requested connect(&AccountManager::getInstance(), &AccountManager::logoutComplete , this, &NodeList::reset); @@ -234,7 +234,7 @@ qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) { statsPacketStream << statsObject.toVariantMap(); - return writeDatagram(statsPacket, _domainInfo.getSockAddr(), QUuid()); + return writeDatagram(statsPacket, _DomainHandler.getSockAddr(), QUuid()); } void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) { @@ -279,7 +279,7 @@ void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteAr break; } case PacketTypeDomainServerRequireDTLS: { - _domainInfo.parseDTLSRequirementPacket(packet); + _DomainHandler.parseDTLSRequirementPacket(packet); break; } case PacketTypePing: { @@ -400,7 +400,7 @@ void NodeList::reset() { setSessionUUID(QUuid()); // clear the domain connection information - _domainInfo.clearConnectionInfo(); + _DomainHandler.clearConnectionInfo(); } void NodeList::addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd) { @@ -575,13 +575,13 @@ void NodeList::sendDomainServerCheckIn() { // we don't know our public socket and we need to send it to the domain server // send a STUN request to figure it out sendSTUNRequest(); - } else if (!_domainInfo.getIP().isNull()) { + } else if (!_DomainHandler.getIP().isNull()) { // construct the DS check in packet PacketType domainPacketType = _sessionUUID.isNull() ? PacketTypeDomainConnectRequest : PacketTypeDomainListRequest; QUuid packetUUID = (domainPacketType == PacketTypeDomainListRequest) - ? _sessionUUID : _domainInfo.getAssignmentUUID(); + ? _sessionUUID : _DomainHandler.getAssignmentUUID(); QByteArray domainServerPacket = byteArrayWithPopulatedHeader(domainPacketType, packetUUID); QDataStream packetStream(&domainServerPacket, QIODevice::Append); @@ -596,7 +596,7 @@ void NodeList::sendDomainServerCheckIn() { packetStream << nodeTypeOfInterest; } - writeDatagram(domainServerPacket, _domainInfo.getSockAddr(), QUuid()); + writeDatagram(domainServerPacket, _DomainHandler.getSockAddr(), QUuid()); const int NUM_DOMAIN_SERVER_CHECKINS_PER_STUN_REQUEST = 5; static unsigned int numDomainCheckins = 0; @@ -632,7 +632,7 @@ int NodeList::processDomainServerList(const QByteArray& packet) { _numNoReplyDomainCheckIns = 0; // if this was the first domain-server list from this domain, we've now connected - _domainInfo.setIsConnected(true); + _DomainHandler.setIsConnected(true); int readNodes = 0; @@ -659,7 +659,7 @@ int NodeList::processDomainServerList(const QByteArray& packet) { // if the public socket address is 0 then it's reachable at the same IP // as the domain server if (nodePublicSocket.getAddress().isNull()) { - nodePublicSocket.setAddress(_domainInfo.getIP()); + nodePublicSocket.setAddress(_DomainHandler.getIP()); } SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket); @@ -881,9 +881,9 @@ void NodeList::loadData(QSettings *settings) { QString domainServerHostname = settings->value(DOMAIN_SERVER_SETTING_KEY).toString(); if (domainServerHostname.size() > 0) { - _domainInfo.setHostname(domainServerHostname); + _DomainHandler.setHostname(domainServerHostname); } else { - _domainInfo.setHostname(DEFAULT_DOMAIN_HOSTNAME); + _DomainHandler.setHostname(DEFAULT_DOMAIN_HOSTNAME); } settings->endGroup(); @@ -892,9 +892,9 @@ void NodeList::loadData(QSettings *settings) { void NodeList::saveData(QSettings* settings) { settings->beginGroup(DOMAIN_SERVER_SETTING_KEY); - if (_domainInfo.getHostname() != DEFAULT_DOMAIN_HOSTNAME) { + if (_DomainHandler.getHostname() != DEFAULT_DOMAIN_HOSTNAME) { // the user is using a different hostname, store it - settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_domainInfo.getHostname())); + settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_DomainHandler.getHostname())); } else { // the user has switched back to default, remove the current setting settings->remove(DOMAIN_SERVER_SETTING_KEY); diff --git a/libraries/shared/src/NodeList.h b/libraries/shared/src/NodeList.h index b12174296b..9c19e33ed9 100644 --- a/libraries/shared/src/NodeList.h +++ b/libraries/shared/src/NodeList.h @@ -31,7 +31,7 @@ #include -#include "DomainInfo.h" +#include "DomainHandler.h" #include "Node.h" const quint64 NODE_SILENCE_THRESHOLD_USECS = 2 * 1000 * 1000; @@ -91,7 +91,7 @@ public: int size() const { return _nodeHash.size(); } int getNumNoReplyDomainCheckIns() const { return _numNoReplyDomainCheckIns; } - DomainInfo& getDomainInfo() { return _domainInfo; } + DomainHandler& getDomainHandler() { return _DomainHandler; } const NodeSet& getNodeInterestSet() const { return _nodeTypesOfInterest; } void addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd); @@ -170,7 +170,7 @@ private: QUdpSocket* _dtlsSocket; NodeType_t _ownerType; NodeSet _nodeTypesOfInterest; - DomainInfo _domainInfo; + DomainHandler _DomainHandler; QUuid _sessionUUID; int _numNoReplyDomainCheckIns; HifiSockAddr _assignmentServerSocket;