mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +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) {
|
||||
QString domainIPString = ipAddressRegex.cap(1);
|
||||
|
||||
qint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||
if (!ipAddressRegex.cap(2).isEmpty()) {
|
||||
domainPort = (qint16) ipAddressRegex.cap(2).toInt();
|
||||
domainPort = (quint16) ipAddressRegex.cap(2).toInt();
|
||||
}
|
||||
|
||||
emit lookupResultsFinished();
|
||||
|
@ -597,7 +597,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri
|
|||
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||
|
||||
if (!hostnameRegex.cap(2).isEmpty()) {
|
||||
domainPort = (qint16)hostnameRegex.cap(2).toInt();
|
||||
domainPort = (quint16)hostnameRegex.cap(2).toInt();
|
||||
}
|
||||
|
||||
emit lookupResultsFinished();
|
||||
|
|
|
@ -156,36 +156,34 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
|
|||
// re-set the domain info so that auth information is reloaded
|
||||
hardReset();
|
||||
|
||||
QString hostname = domainURL.host();
|
||||
quint16 port = domainURL.port();
|
||||
|
||||
QString previousHost = _domainURL.host();
|
||||
_domainURL = domainURL;
|
||||
|
||||
if (domainURL.scheme() != URL_SCHEME_HIFI) {
|
||||
setIsConnected(true);
|
||||
} else if (hostname != _domainURL.host()) {
|
||||
qCDebug(networking) << "Updated domain hostname to" << hostname;
|
||||
} else if (previousHost != domainURL.host()) {
|
||||
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
|
||||
qCDebug(networking, "Looking up DS hostname %s.", hostname.toLocal8Bit().constData());
|
||||
QHostInfo::lookupHost(hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||
qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData());
|
||||
QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||
|
||||
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(
|
||||
LimitedNodeList::ConnectionStep::SetDomainHostname);
|
||||
|
||||
UserActivityLogger::getInstance().changedDomain(hostname);
|
||||
UserActivityLogger::getInstance().changedDomain(domainURL.host());
|
||||
}
|
||||
}
|
||||
|
||||
emit domainURLChanged(_domainURL);
|
||||
|
||||
if (_sockAddr.getPort() != port) {
|
||||
qCDebug(networking) << "Updated domain port to" << port;
|
||||
if (_sockAddr.getPort() != domainURL.port()) {
|
||||
qCDebug(networking) << "Updated domain port to" << domainURL.port();
|
||||
}
|
||||
|
||||
// grab the port by reading the string after the colon
|
||||
_sockAddr.setPort(port);
|
||||
_sockAddr.setPort(domainURL.port());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue