mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 09:33:49 +02:00
separate ICE ID and domain ID for reconnections to moved domains
This commit is contained in:
parent
cbc505e71a
commit
5203113b41
4 changed files with 17 additions and 8 deletions
|
@ -3462,9 +3462,9 @@ void Application::updateWindowTitle(){
|
|||
void Application::updateLocationInServer() {
|
||||
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
const QUuid& domainUUID = NodeList::getInstance()->getDomainHandler().getUUID();
|
||||
DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler();
|
||||
|
||||
if (accountManager.isLoggedIn() && !domainUUID.isNull()) {
|
||||
if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) {
|
||||
|
||||
// construct a QJsonObject given the user's current address information
|
||||
QJsonObject rootObject;
|
||||
|
@ -3478,7 +3478,7 @@ void Application::updateLocationInServer() {
|
|||
const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id";
|
||||
|
||||
locationObject.insert(PATH_KEY_IN_LOCATION, pathString);
|
||||
locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainUUID.toString());
|
||||
locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString());
|
||||
|
||||
rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ DomainHandler::DomainHandler(QObject* parent) :
|
|||
_uuid(),
|
||||
_sockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
|
||||
_assignmentUUID(),
|
||||
_iceDomainID(),
|
||||
_iceClientID(),
|
||||
_iceServerSockAddr(),
|
||||
_icePeer(),
|
||||
|
@ -39,9 +40,13 @@ DomainHandler::DomainHandler(QObject* parent) :
|
|||
void DomainHandler::clearConnectionInfo() {
|
||||
_uuid = QUuid();
|
||||
|
||||
_iceServerSockAddr = HifiSockAddr();
|
||||
_icePeer = NetworkPeer();
|
||||
|
||||
if (requiresICE()) {
|
||||
// if we connected to this domain with ICE, re-set the socket so we reconnect through the ice-server
|
||||
_sockAddr.setAddress(QHostAddress::Null);
|
||||
}
|
||||
|
||||
_isConnected = false;
|
||||
|
||||
emit disconnectedFromDomain();
|
||||
|
@ -65,6 +70,7 @@ void DomainHandler::softReset() {
|
|||
|
||||
void DomainHandler::hardReset() {
|
||||
softReset();
|
||||
_iceDomainID = QUuid();
|
||||
_hostname = QString();
|
||||
_sockAddr.setAddress(QHostAddress::Null);
|
||||
}
|
||||
|
@ -136,7 +142,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
|
|||
// re-set the domain info to connect to new domain
|
||||
hardReset();
|
||||
|
||||
setUUID(id);
|
||||
_iceDomainID = id;
|
||||
_iceServerSockAddr = HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
|
||||
|
||||
// refresh our ICE client UUID to something new
|
||||
|
@ -265,7 +271,7 @@ void DomainHandler::processICEResponsePacket(const QByteArray& icePacket) {
|
|||
NetworkPeer packetPeer;
|
||||
iceResponseStream >> packetPeer;
|
||||
|
||||
if (packetPeer.getUUID() != _uuid) {
|
||||
if (packetPeer.getUUID() != _iceDomainID) {
|
||||
qDebug() << "Received a network peer with ID that does not match current domain. Will not attempt connection.";
|
||||
} else {
|
||||
qDebug() << "Received network peer object for domain -" << packetPeer;
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
const QUuid& getAssignmentUUID() const { return _assignmentUUID; }
|
||||
void setAssignmentUUID(const QUuid& assignmentUUID) { _assignmentUUID = assignmentUUID; }
|
||||
|
||||
const QUuid& getICEDomainID() const { return _iceDomainID; }
|
||||
|
||||
const QUuid& getICEClientID() const { return _iceClientID; }
|
||||
|
||||
bool requiresICE() const { return !_iceServerSockAddr.isNull(); }
|
||||
|
@ -97,6 +99,7 @@ private:
|
|||
QString _hostname;
|
||||
HifiSockAddr _sockAddr;
|
||||
QUuid _assignmentUUID;
|
||||
QUuid _iceDomainID;
|
||||
QUuid _iceClientID;
|
||||
HifiSockAddr _iceServerSockAddr;
|
||||
NetworkPeer _icePeer;
|
||||
|
|
|
@ -342,10 +342,10 @@ void NodeList::handleICEConnectionToDomainServer() {
|
|||
|
||||
LimitedNodeList::sendHeartbeatToIceServer(_domainHandler.getICEServerSockAddr(),
|
||||
_domainHandler.getICEClientID(),
|
||||
_domainHandler.getUUID());
|
||||
_domainHandler.getICEDomainID());
|
||||
} else {
|
||||
qDebug() << "Sending ping packets to establish connectivity with domain-server with ID"
|
||||
<< uuidStringWithoutCurlyBraces(_domainHandler.getUUID());
|
||||
<< uuidStringWithoutCurlyBraces(_domainHandler.getICEDomainID());
|
||||
|
||||
// send the ping packet to the local and public sockets for this nodfe
|
||||
QByteArray localPingPacket = constructPingPacket(PingType::Local, false, _domainHandler.getICEClientID());
|
||||
|
|
Loading…
Reference in a new issue