From 52734ec862b06ca050b7a483fe232142cdd23507 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 28 Sep 2010 14:11:16 +0200 Subject: 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 Reviewed-by: Markus Goetz --- src/network/kernel/qhostinfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } /*! -- cgit v0.12