diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-03-21 18:53:42 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-03-22 10:11:34 (GMT) |
commit | 40fc1a3ca3b7050f317513cf69dd89a01479e098 (patch) | |
tree | 2fdfe24c95445d1cda24aed56b6690b35c726401 /src/network/kernel | |
parent | 67c6737c6702506b5b09fd84389e20ba539cc000 (diff) | |
download | Qt-40fc1a3ca3b7050f317513cf69dd89a01479e098.zip Qt-40fc1a3ca3b7050f317513cf69dd89a01479e098.tar.gz Qt-40fc1a3ca3b7050f317513cf69dd89a01479e098.tar.bz2 |
Implement network session support for synchronous QHostInfo
Private API, QHostInfoPrivate::fromName, which is called from
QAbstractSocket when the network session property is set.
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 14 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_p.h | 5 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_symbian.cpp | 15 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 1ae0bbd..aff55d9 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -272,6 +272,20 @@ QHostInfo QHostInfo::fromName(const QString &name) return hostInfo; } +#ifndef QT_NO_BEARERMANAGEMENT +QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetworkSession> session) +{ +#if defined QHOSTINFO_DEBUG + qDebug("QHostInfoPrivate::fromName(\"%s\") with session %p",name.toLatin1().constData(), session.data()); +#endif + + QHostInfo hostInfo = QHostInfoAgent::fromName(name, session); + QAbstractHostInfoLookupManger* manager = theHostInfoLookupManager(); + manager->cache.put(name, hostInfo); + return hostInfo; +} +#endif + /*! \enum QHostInfo::HostInfoError diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index e3f7f19..a40104a 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -70,6 +70,7 @@ #include <QCache> #include <QNetworkSession> +#include <QSharedPointer> #ifdef Q_OS_SYMBIAN // Symbian Headers @@ -117,6 +118,10 @@ public: lookupId(0) { } +#ifndef QT_NO_BEARERMANAGEMENT + //not a public API yet + static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession); +#endif QHostInfo::HostInfoError err; QString errorStr; diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp index 347bf67..65c3d62 100644 --- a/src/network/kernel/qhostinfo_symbian.cpp +++ b/src/network/kernel/qhostinfo_symbian.cpp @@ -66,16 +66,11 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetw RHostResolver hostResolver; - // TODO - check if networkSession is null - // RConnection connection = magicalApi(networkSession); - // int err = connection.Open(blah, blah); - // if (err) { - // do something; - // } - - // Will return both IPv4 and IPv6 - // TODO: Pass RHostResolver.Open() the global RConnection - int err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp); + int err; + if (networkSession) + err = QNetworkSessionPrivate::nativeOpenHostResolver(*networkSession, hostResolver, KAfInet, KProtocolInetUdp); + else + err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp); if (err) { results.setError(QHostInfo::UnknownError); results.setErrorString(QSystemError(err,QSystemError::NativeError).toString()); |