diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-05-05 10:37:21 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-05-05 11:37:13 (GMT) |
commit | ff2b6ddfd2763b6b365c7466d51a1e2374e4bd4b (patch) | |
tree | 9fd0940d6be6f7c35a49155eac6ee8f6466e12eb /src/network | |
parent | 95a69f37ec156a2506b140e5e349bb7f68e112a5 (diff) | |
download | Qt-ff2b6ddfd2763b6b365c7466d51a1e2374e4bd4b.zip Qt-ff2b6ddfd2763b6b365c7466d51a1e2374e4bd4b.tar.gz Qt-ff2b6ddfd2763b6b365c7466d51a1e2374e4bd4b.tar.bz2 |
QHostInfo: Emit postponed lookup results when finishing current
Reviewed-by: Thiago
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 12 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_p.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index fd39347..28a6c84 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -471,6 +471,18 @@ void QHostInfoRunnable::run() hostInfo.setLookupId(id); resultEmitter.emitResultsReady(hostInfo); + // now also iterate through the postponed ones + QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups); + while (iterator.hasNext()) { + QHostInfoRunnable* postponed = iterator.next(); + if (toBeLookedUp == postponed->toBeLookedUp) { + // we can now emit + iterator.remove(); + hostInfo.setLookupId(postponed->id); + postponed->resultEmitter.emitResultsReady(hostInfo); + } + } + manager->lookupFinished(this); // thread goes back to QThreadPool diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index e11766b..af270d8 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -173,6 +173,8 @@ public: bool wasAborted(int id); QHostInfoCache cache; + + friend class QHostInfoRunnable; protected: QList<QHostInfoRunnable*> currentLookups; // in progress QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host |