From 7cb8cbfdd4313c74de05449bb1dbf314c2849328 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 Oct 2014 14:49:25 -0700 Subject: [PATCH] repairs to domain change reset to clear nodes --- libraries/networking/src/DomainHandler.cpp | 7 ++++--- libraries/networking/src/NodeList.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 760c9f4c04..81d6a6d662 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -47,9 +47,7 @@ void DomainHandler::clearConnectionInfo() { _sockAddr.setAddress(QHostAddress::Null); } - _isConnected = false; - - emit disconnectedFromDomain(); + setIsConnected(false); if (_handshakeTimer) { _handshakeTimer->stop(); @@ -64,12 +62,15 @@ void DomainHandler::clearSettings() { } void DomainHandler::softReset() { + qDebug() << "Resetting current domain connection information."; clearConnectionInfo(); clearSettings(); } void DomainHandler::hardReset() { softReset(); + + qDebug() << "Hard reset in NodeList DomainHandler."; _iceDomainID = QUuid(); _hostname = QString(); _sockAddr.setAddress(QHostAddress::Null); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index f8da7cdbfa..feeb13500a 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -62,7 +62,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned _stunRequestsSinceSuccess(0) { // clear our NodeList when the domain changes - connect(&_domainHandler, &DomainHandler::hostnameChanged, this, &NodeList::reset); + connect(&_domainHandler, &DomainHandler::disconnectedFromDomain, this, &NodeList::reset); // handle ICE signal from DS so connection is attempted immediately connect(&_domainHandler, &DomainHandler::requestICEConnectionAttempt, this, &NodeList::handleICEConnectionToDomainServer); @@ -205,8 +205,10 @@ void NodeList::reset() { // refresh the owner UUID to the NULL UUID setSessionUUID(QUuid()); - // clear the domain connection information - _domainHandler.softReset(); + if (sender() != &_domainHandler) { + // clear the domain connection information, unless they're the ones that asked us to reset + _domainHandler.softReset(); + } // if we setup the DTLS socket, also disconnect from the DTLS socket readyRead() so it can handle handshaking if (_dtlsSocket) { @@ -332,7 +334,7 @@ void NodeList::sendDomainServerCheckIn() { if (_numNoReplyDomainCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) { // we haven't heard back from DS in MAX_SILENT_DOMAIN_SERVER_CHECK_INS - // so emit our signal that indicates that + // so emit our signal that says that emit limitOfSilentDomainCheckInsReached(); }