mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
fix going to a dns name or ip address
This commit is contained in:
parent
c781f88239
commit
274c3224a2
2 changed files with 13 additions and 15 deletions
|
@ -574,9 +574,9 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri
|
||||||
if (ipAddressRegex.indexIn(lookupString) != -1) {
|
if (ipAddressRegex.indexIn(lookupString) != -1) {
|
||||||
QString domainIPString = ipAddressRegex.cap(1);
|
QString domainIPString = ipAddressRegex.cap(1);
|
||||||
|
|
||||||
qint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||||
if (!ipAddressRegex.cap(2).isEmpty()) {
|
if (!ipAddressRegex.cap(2).isEmpty()) {
|
||||||
domainPort = (qint16) ipAddressRegex.cap(2).toInt();
|
domainPort = (quint16) ipAddressRegex.cap(2).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit lookupResultsFinished();
|
emit lookupResultsFinished();
|
||||||
|
@ -597,7 +597,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri
|
||||||
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||||
|
|
||||||
if (!hostnameRegex.cap(2).isEmpty()) {
|
if (!hostnameRegex.cap(2).isEmpty()) {
|
||||||
domainPort = (qint16)hostnameRegex.cap(2).toInt();
|
domainPort = (quint16)hostnameRegex.cap(2).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit lookupResultsFinished();
|
emit lookupResultsFinished();
|
||||||
|
|
|
@ -156,36 +156,34 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
|
||||||
// re-set the domain info so that auth information is reloaded
|
// re-set the domain info so that auth information is reloaded
|
||||||
hardReset();
|
hardReset();
|
||||||
|
|
||||||
QString hostname = domainURL.host();
|
QString previousHost = _domainURL.host();
|
||||||
quint16 port = domainURL.port();
|
|
||||||
|
|
||||||
_domainURL = domainURL;
|
_domainURL = domainURL;
|
||||||
|
|
||||||
if (domainURL.scheme() != URL_SCHEME_HIFI) {
|
if (domainURL.scheme() != URL_SCHEME_HIFI) {
|
||||||
setIsConnected(true);
|
setIsConnected(true);
|
||||||
} else if (hostname != _domainURL.host()) {
|
} else if (previousHost != domainURL.host()) {
|
||||||
qCDebug(networking) << "Updated domain hostname to" << hostname;
|
qCDebug(networking) << "Updated domain hostname to" << domainURL.host();
|
||||||
|
|
||||||
if (!hostname.isEmpty()) {
|
if (!domainURL.host().isEmpty()) {
|
||||||
// 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
|
||||||
qCDebug(networking, "Looking up DS hostname %s.", hostname.toLocal8Bit().constData());
|
qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData());
|
||||||
QHostInfo::lookupHost(hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||||
|
|
||||||
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(
|
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(
|
||||||
LimitedNodeList::ConnectionStep::SetDomainHostname);
|
LimitedNodeList::ConnectionStep::SetDomainHostname);
|
||||||
|
|
||||||
UserActivityLogger::getInstance().changedDomain(hostname);
|
UserActivityLogger::getInstance().changedDomain(domainURL.host());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit domainURLChanged(_domainURL);
|
emit domainURLChanged(_domainURL);
|
||||||
|
|
||||||
if (_sockAddr.getPort() != port) {
|
if (_sockAddr.getPort() != domainURL.port()) {
|
||||||
qCDebug(networking) << "Updated domain port to" << port;
|
qCDebug(networking) << "Updated domain port to" << domainURL.port();
|
||||||
}
|
}
|
||||||
|
|
||||||
// grab the port by reading the string after the colon
|
// grab the port by reading the string after the colon
|
||||||
_sockAddr.setPort(port);
|
_sockAddr.setPort(domainURL.port());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue