diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-04-05 15:30:19 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-04-05 15:45:59 (GMT) |
commit | 3915dd40b967fbf96a53820a8130342280a5b299 (patch) | |
tree | aa59efee813bbd960ff0695771811be96ff7dfc4 /src/network | |
parent | dc474b5d19f66dc3ede087ae6fa8ec6f9245477e (diff) | |
download | Qt-3915dd40b967fbf96a53820a8130342280a5b299.zip Qt-3915dd40b967fbf96a53820a8130342280a5b299.tar.gz Qt-3915dd40b967fbf96a53820a8130342280a5b299.tar.bz2 |
QHostInfo symbian backend finalisation
For reverse lookups, don't report errors, instead just return the IP
address as a string for the host name (for behavioural compability
with the windows and unix backends)
Don't sort IP4 addresses before IP6 addresses for the same host. The
symbian host resolver internally sorts the list so the usable addresses
are returned first. (usable means has a valid route)
Task-number: QTBUG-18135
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/kernel/qhostinfo_symbian.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp index 40ede54..2a8de1d 100644 --- a/src/network/kernel/qhostinfo_symbian.cpp +++ b/src/network/kernel/qhostinfo_symbian.cpp @@ -117,11 +117,13 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetw // Synchronous request. nameResult returns Host Name. err = hostResolver.GetByAddress(IpAdd, nameResult); if (err) { - setError_helper(results, err); + //for behavioural compatibility with Qt 4.7 and unix/windows + //backends: don't report error, return ip address as host name + results.setHostName(address.toString()); } else { results.setHostName(qt_TDesC2QString(nameResult().iName)); - results.setAddresses(QList<QHostAddress>() << address); } + results.setAddresses(QList<QHostAddress>() << address); return results; } @@ -188,8 +190,7 @@ QString QHostInfo::localHostName() RSocketServ socketServ(qt_symbianGetSocketServer()); RHostResolver hostResolver; - // Will return both IPv4 and IPv6 - // TODO: Pass RHostResolver.Open() the global RConnection + // RConnection not required to get the host name int err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp); if (err) return QString(); @@ -420,13 +421,7 @@ void QSymbianHostResolver::processNameResult() // Ensure that record is valid (not an alias and with length greater than 0) if (!(iNameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) { - if (iNameResult().iAddr.Family() == KAfInet) { - // IPv4 - prepend - iHostAddresses.prepend(QHostAddress(qt_TDesC2QString(ipAddr))); - } else { - // IPv6 - append - iHostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); - } + iHostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); } iState = EGetByName; @@ -453,11 +448,13 @@ void QSymbianHostResolver::processAddressResult() TInt err = iStatus.Int(); if (err < 0) { - setError_helper(iResults, err); + //For behavioural compatibility with Qt 4.7, don't report errors on reverse lookup, + //return the address as a string (same as unix/windows backends) + iResults.setHostName(iAddress.toString()); } else { iResults.setHostName(qt_TDesC2QString(iNameResult().iName)); - iResults.setAddresses(QList<QHostAddress>() << iAddress); } + iResults.setAddresses(QList<QHostAddress>() << iAddress); returnResults(); } @@ -523,6 +520,7 @@ void QSymbianHostInfoLookupManager::runNextLookup() // if spare capacity, try to start another one if (iCurrentLookups.count() >= KMaxConcurrentLookups) break; + i--; //compensate for removeAt } } } |