Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.6
-
None
Description
By default QHostInfo::fromName() put data to DNS cache, but doesn't use it, turn on use DNS case reduce number of the requests, e.g. at my case this is reduce number of the requests form 13 to 2.
Patch very simple
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 23b83cf8e6..bf65b9bac0 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -424,8 +424,12 @@ QHostInfo QHostInfo::fromName(const QString &name) qDebug("QHostInfo::fromName(\"%s\")",name.toLatin1().constData()); #endif - QHostInfo hostInfo = QHostInfoAgent::fromName(name); QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); + bool ok = false; + QHostInfo hostInfo = manager->cache.get(name, &ok); + if (ok) + return hostInfo; + hostInfo = QHostInfoAgent::fromName(name); manager->cache.put(name, hostInfo); return hostInfo; }