diff options
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 11 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_p.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index d2dc7c4850..a2ac9065fd 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -689,6 +689,7 @@ void qt_qhostinfo_clear_cache() } } +#ifdef QT_BUILD_INTERNAL void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e) { QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); @@ -697,6 +698,16 @@ void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e) } } +void qt_qhostinfo_cache_inject(const QString &hostname, const QHostInfo &resolution) +{ + QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); + if (!manager || !manager->cache.isEnabled()) + return; + + manager->cache.put(hostname, resolution); +} +#endif + // cache for 60 seconds // cache 128 items QHostInfoCache::QHostInfoCache() : max_age(60), enabled(true), cache(128) diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index 74cfe2a9aa..a99c3dc8ca 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -117,6 +117,7 @@ public: QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id); void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache(); void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e); +void Q_AUTOTEST_EXPORT qt_qhostinfo_cache_inject(const QString &hostname, const QHostInfo &resolution); class QHostInfoCache { |