mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:36:47 +02:00
re-set domain auth info if hostname changes
This commit is contained in:
parent
8a0136efe1
commit
b87d65df30
2 changed files with 14 additions and 2 deletions
|
@ -17,9 +17,20 @@ DomainInfo::DomainInfo() :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DomainInfo::reset() {
|
||||||
|
_hostname = QString();
|
||||||
|
_sockAddr.setAddress(QHostAddress::Null);
|
||||||
|
_connectionSecret = QString();
|
||||||
|
_registrationToken = QString();
|
||||||
|
_rootAuthenticationURL = QUrl();
|
||||||
|
}
|
||||||
|
|
||||||
void DomainInfo::setHostname(const QString& hostname) {
|
void DomainInfo::setHostname(const QString& hostname) {
|
||||||
|
|
||||||
if (hostname != _hostname) {
|
if (hostname != _hostname) {
|
||||||
|
// re-set the domain info so that auth information is reloaded
|
||||||
|
reset();
|
||||||
|
|
||||||
int colonIndex = hostname.indexOf(':');
|
int colonIndex = hostname.indexOf(':');
|
||||||
|
|
||||||
if (colonIndex > 0) {
|
if (colonIndex > 0) {
|
||||||
|
@ -40,9 +51,8 @@ void DomainInfo::setHostname(const QString& hostname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
|
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
|
||||||
_sockAddr.setAddress(QHostAddress::Null);
|
|
||||||
qDebug("Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
qDebug("Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
||||||
QHostInfo::lookupHost(_hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
QHostInfo::lookupHost(_hostname, this, SLOT(completedHostnameLookup));
|
||||||
|
|
||||||
emit hostnameChanged(_hostname);
|
emit hostnameChanged(_hostname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ private slots:
|
||||||
signals:
|
signals:
|
||||||
void hostnameChanged(const QString& hostname);
|
void hostnameChanged(const QString& hostname);
|
||||||
private:
|
private:
|
||||||
|
void reset();
|
||||||
|
|
||||||
QString _hostname;
|
QString _hostname;
|
||||||
HifiSockAddr _sockAddr;
|
HifiSockAddr _sockAddr;
|
||||||
QUuid _connectionSecret;
|
QUuid _connectionSecret;
|
||||||
|
|
Loading…
Reference in a new issue