equal
deleted
inserted
replaced
82 { |
82 { |
83 emit resultsReady(info); |
83 emit resultsReady(info); |
84 } |
84 } |
85 |
85 |
86 Q_SIGNALS: |
86 Q_SIGNALS: |
87 void resultsReady(const QHostInfo info); |
87 void resultsReady(const QHostInfo &info); |
88 }; |
88 }; |
89 |
89 |
90 // needs to be QObject because fromName calls tr() |
90 // needs to be QObject because fromName calls tr() |
91 class QHostInfoAgent : public QObject |
91 class QHostInfoAgent : public QObject |
92 { |
92 { |
114 |
114 |
115 #ifndef QT_NO_THREAD |
115 #ifndef QT_NO_THREAD |
116 // These functions are outside of the QHostInfo class and strictly internal. |
116 // These functions are outside of the QHostInfo class and strictly internal. |
117 // Do NOT use them outside of QAbstractSocket. |
117 // Do NOT use them outside of QAbstractSocket. |
118 QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id); |
118 QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id); |
119 void Q_NETWORK_EXPORT qt_qhostinfo_clear_cache(); |
119 void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache(); |
120 void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e); |
120 void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e); |
121 |
121 |
122 class QHostInfoCache |
122 class QHostInfoCache |
123 { |
123 { |
124 public: |
124 public: |
159 Q_OBJECT |
159 Q_OBJECT |
160 public: |
160 public: |
161 QHostInfoLookupManager(); |
161 QHostInfoLookupManager(); |
162 ~QHostInfoLookupManager(); |
162 ~QHostInfoLookupManager(); |
163 |
163 |
|
164 void clear(); |
164 void work(); |
165 void work(); |
165 |
166 |
166 // called from QHostInfo |
167 // called from QHostInfo |
167 void scheduleLookup(QHostInfoRunnable *r); |
168 void scheduleLookup(QHostInfoRunnable *r); |
168 void abortLookup(int id); |
169 void abortLookup(int id); |
170 // called from QHostInfoRunnable |
171 // called from QHostInfoRunnable |
171 void lookupFinished(QHostInfoRunnable *r); |
172 void lookupFinished(QHostInfoRunnable *r); |
172 bool wasAborted(int id); |
173 bool wasAborted(int id); |
173 |
174 |
174 QHostInfoCache cache; |
175 QHostInfoCache cache; |
|
176 |
|
177 friend class QHostInfoRunnable; |
175 protected: |
178 protected: |
176 QList<QHostInfoRunnable*> currentLookups; // in progress |
179 QList<QHostInfoRunnable*> currentLookups; // in progress |
177 QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host |
180 QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host |
178 QQueue<QHostInfoRunnable*> scheduledLookups; // not yet started |
181 QQueue<QHostInfoRunnable*> scheduledLookups; // not yet started |
179 QList<QHostInfoRunnable*> finishedLookups; // recently finished |
182 QList<QHostInfoRunnable*> finishedLookups; // recently finished |