summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2010-09-28 12:11:16 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-28 14:00:10 (GMT)
commit52734ec862b06ca050b7a483fe232142cdd23507 (patch)
tree46f4ad68fefb6bf2f99222630f536bda78857028 /src/network/kernel
parent4f82ba7aeb62da4c8f537a697ced68c43d262f8f (diff)
downloadQt-52734ec862b06ca050b7a483fe232142cdd23507.zip
Qt-52734ec862b06ca050b7a483fe232142cdd23507.tar.gz
Qt-52734ec862b06ca050b7a483fe232142cdd23507.tar.bz2
Insert the result of QHostInfo::fromName into the hostinfo cache, too.
This way both synchronous and asynchronous lookups are cached, resulting in more reliable behavior: this issue was detected by kde's ktcpsockettest where state() was sometimes HostLookupState and sometimes ConnectedState, depending on whether the previous lookups were done by the thread or by the blocking lookup in QAbstractSocket::waitForConnected. Merge-request: 829 Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com> Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qhostinfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 41a9512..f984cf8 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -243,7 +243,10 @@ QHostInfo QHostInfo::fromName(const QString &name)
qDebug("QHostInfo::fromName(\"%s\")",name.toLatin1().constData());
#endif
- return QHostInfoAgent::fromName(name);
+ QHostInfo hostInfo = QHostInfoAgent::fromName(name);
+ QHostInfoLookupManager *manager = theHostInfoLookupManager();
+ manager->cache.put(name, hostInfo);
+ return hostInfo;
}
/*!