Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/kernel/qdnslookup.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | namespace { namespace Q_QGS_theDnsLookupThreadPool { typedef QDnsLookupThreadPool Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 2 times by 2 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 2 times by 2 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 101 times by 2 tests: &holder.value;return &holder.value; Executed by:
executed 101 times by 2 tests: } } } static QGlobalStatic<QDnsLookupThreadPool, Q_QGS_theDnsLookupThreadPool::innerFunction, Q_QGS_theDnsLookupThreadPool::guard> theDnsLookupThreadPool;;return &holder.value; Executed by:
| 0-101 | ||||||||||||
8 | namespace { namespace Q_QGS_theDnsLookupSeedStorage { typedef QThreadStorage<bool *> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 2 times by 2 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 2 times by 2 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 107 times by 2 tests: &holder.value;return &holder.value; Executed by:
executed 107 times by 2 tests: } } } static QGlobalStatic<QThreadStorage<bool *>, Q_QGS_theDnsLookupSeedStorage::innerFunction, Q_QGS_theDnsLookupSeedStorage::guard> theDnsLookupSeedStorage;;return &holder.value; Executed by:
| 0-107 | ||||||||||||
9 | - | |||||||||||||
10 | static bool qt_qdnsmailexchangerecord_less_than(const QDnsMailExchangeRecord &r1, const QDnsMailExchangeRecord &r2) | - | ||||||||||||
11 | { | - | ||||||||||||
12 | - | |||||||||||||
13 | return executed 7 times by 1 test: r1.preference() < r2.preference();return r1.preference() < r2.preference(); Executed by:
executed 7 times by 1 test: return r1.preference() < r2.preference(); Executed by:
| 7 | ||||||||||||
14 | } | - | ||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | - | |||||||||||||
19 | - | |||||||||||||
20 | static void qt_qdnsmailexchangerecord_sort(QList<QDnsMailExchangeRecord> &records) | - | ||||||||||||
21 | { | - | ||||||||||||
22 | - | |||||||||||||
23 | if (records.size() <= 1
| 4-80 | ||||||||||||
24 | return; executed 80 times by 2 tests: return; Executed by:
| 80 | ||||||||||||
25 | - | |||||||||||||
26 | - | |||||||||||||
27 | std::sort(records.begin(), records.end(), qt_qdnsmailexchangerecord_less_than); | - | ||||||||||||
28 | - | |||||||||||||
29 | int i = 0; | - | ||||||||||||
30 | while (i < records.size()
| 4-6 | ||||||||||||
31 | - | |||||||||||||
32 | - | |||||||||||||
33 | QList<QDnsMailExchangeRecord> slice; | - | ||||||||||||
34 | const quint16 slicePreference = records[i].preference(); | - | ||||||||||||
35 | for (int j = i; j < records.size()
| 4-10 | ||||||||||||
36 | if (records[j].preference() != slicePreference
| 2-8 | ||||||||||||
37 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
38 | slice << records[j]; | - | ||||||||||||
39 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
40 | - | |||||||||||||
41 | - | |||||||||||||
42 | while (!slice.isEmpty()
| 6-8 | ||||||||||||
43 | const unsigned int pos = qrand() % slice.size(); | - | ||||||||||||
44 | records[i++] = slice.takeAt(pos); | - | ||||||||||||
45 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
46 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
47 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
48 | - | |||||||||||||
49 | static bool qt_qdnsservicerecord_less_than(const QDnsServiceRecord &r1, const QDnsServiceRecord &r2) | - | ||||||||||||
50 | { | - | ||||||||||||
51 | - | |||||||||||||
52 | - | |||||||||||||
53 | return executed 18 times by 1 test: r1.priority() < r2.priority()return r1.priority() < r2.priority() || (r1.priority() == r2.priority() && r1.weight() == 0 && r2.weight() > 0); Executed by:
executed 18 times by 1 test: return r1.priority() < r2.priority() || (r1.priority() == r2.priority() && r1.weight() == 0 && r2.weight() > 0); Executed by:
| 4-18 | ||||||||||||
54 | || (r1.priority() == r2.priority()
executed 18 times by 1 test: return r1.priority() < r2.priority() || (r1.priority() == r2.priority() && r1.weight() == 0 && r2.weight() > 0); Executed by:
| 7-18 | ||||||||||||
55 | && r1.weight() == 0
executed 18 times by 1 test: return r1.priority() < r2.priority() || (r1.priority() == r2.priority() && r1.weight() == 0 && r2.weight() > 0); Executed by:
| 0-18 | ||||||||||||
56 | } | - | ||||||||||||
57 | - | |||||||||||||
58 | - | |||||||||||||
59 | - | |||||||||||||
60 | - | |||||||||||||
61 | - | |||||||||||||
62 | static void qt_qdnsservicerecord_sort(QList<QDnsServiceRecord> &records) | - | ||||||||||||
63 | { | - | ||||||||||||
64 | - | |||||||||||||
65 | if (records.size() <= 1
| 6-78 | ||||||||||||
66 | return; executed 78 times by 2 tests: return; Executed by:
| 78 | ||||||||||||
67 | - | |||||||||||||
68 | - | |||||||||||||
69 | - | |||||||||||||
70 | std::sort(records.begin(), records.end(), qt_qdnsservicerecord_less_than); | - | ||||||||||||
71 | - | |||||||||||||
72 | int i = 0; | - | ||||||||||||
73 | while (i < records.size()
| 6-12 | ||||||||||||
74 | - | |||||||||||||
75 | - | |||||||||||||
76 | QList<QDnsServiceRecord> slice; | - | ||||||||||||
77 | const quint16 slicePriority = records[i].priority(); | - | ||||||||||||
78 | unsigned int sliceWeight = 0; | - | ||||||||||||
79 | for (int j = i; j < records.size()
| 6-22 | ||||||||||||
80 | if (records[j].priority() != slicePriority
| 6-16 | ||||||||||||
81 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||
82 | sliceWeight += records[j].weight(); | - | ||||||||||||
83 | slice << records[j]; | - | ||||||||||||
84 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||
85 | - | |||||||||||||
86 | - | |||||||||||||
87 | - | |||||||||||||
88 | - | |||||||||||||
89 | - | |||||||||||||
90 | - | |||||||||||||
91 | while (!slice.isEmpty()
| 12-16 | ||||||||||||
92 | const unsigned int weightThreshold = qrand() % (sliceWeight + 1); | - | ||||||||||||
93 | unsigned int summedWeight = 0; | - | ||||||||||||
94 | for (int j = 0; j < slice.size()
| 0-17 | ||||||||||||
95 | summedWeight += slice[j].weight(); | - | ||||||||||||
96 | if (summedWeight >= weightThreshold
| 1-16 | ||||||||||||
97 | - | |||||||||||||
98 | - | |||||||||||||
99 | - | |||||||||||||
100 | - | |||||||||||||
101 | - | |||||||||||||
102 | - | |||||||||||||
103 | sliceWeight -= slice[j].weight(); | - | ||||||||||||
104 | records[i++] = slice.takeAt(j); | - | ||||||||||||
105 | break; executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||
106 | } | - | ||||||||||||
107 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
108 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||
109 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||
110 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
111 | - | |||||||||||||
112 | const char *QDnsLookupPrivate::msgNoIpV6NameServerAdresses = | - | ||||||||||||
113 | "IPv6 addresses for nameservers are currently not supported"; | - | ||||||||||||
114 | QDnsLookup::QDnsLookup(QObject *parent) | - | ||||||||||||
115 | : QObject(*new QDnsLookupPrivate, parent) | - | ||||||||||||
116 | { | - | ||||||||||||
117 | qRegisterMetaType<QDnsLookupReply>(); | - | ||||||||||||
118 | } executed 76 times by 1 test: end of block Executed by:
| 76 | ||||||||||||
119 | - | |||||||||||||
120 | - | |||||||||||||
121 | - | |||||||||||||
122 | - | |||||||||||||
123 | - | |||||||||||||
124 | QDnsLookup::QDnsLookup(Type type, const QString &name, QObject *parent) | - | ||||||||||||
125 | : QObject(*new QDnsLookupPrivate, parent) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
128 | qRegisterMetaType<QDnsLookupReply>(); | - | ||||||||||||
129 | d->name = name; | - | ||||||||||||
130 | d->type = type; | - | ||||||||||||
131 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||
132 | QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent) | - | ||||||||||||
133 | : QObject(*new QDnsLookupPrivate, parent) | - | ||||||||||||
134 | { | - | ||||||||||||
135 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
136 | qRegisterMetaType<QDnsLookupReply>(); | - | ||||||||||||
137 | d->name = name; | - | ||||||||||||
138 | d->type = type; | - | ||||||||||||
139 | d->nameserver = nameserver; | - | ||||||||||||
140 | } never executed: end of block | 0 | ||||||||||||
141 | QDnsLookup::~QDnsLookup() | - | ||||||||||||
142 | { | - | ||||||||||||
143 | } | - | ||||||||||||
144 | - | |||||||||||||
145 | - | |||||||||||||
146 | - | |||||||||||||
147 | - | |||||||||||||
148 | - | |||||||||||||
149 | - | |||||||||||||
150 | QDnsLookup::Error QDnsLookup::error() const | - | ||||||||||||
151 | { | - | ||||||||||||
152 | return executed 152 times by 1 test: d_func()->reply.error;return d_func()->reply.error; Executed by:
executed 152 times by 1 test: return d_func()->reply.error; Executed by:
| 152 | ||||||||||||
153 | } | - | ||||||||||||
154 | - | |||||||||||||
155 | - | |||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | - | |||||||||||||
159 | - | |||||||||||||
160 | QString QDnsLookup::errorString() const | - | ||||||||||||
161 | { | - | ||||||||||||
162 | return executed 112 times by 1 test: d_func()->reply.errorString;return d_func()->reply.errorString; Executed by:
executed 112 times by 1 test: return d_func()->reply.errorString; Executed by:
| 112 | ||||||||||||
163 | } | - | ||||||||||||
164 | - | |||||||||||||
165 | - | |||||||||||||
166 | - | |||||||||||||
167 | - | |||||||||||||
168 | - | |||||||||||||
169 | bool QDnsLookup::isFinished() const | - | ||||||||||||
170 | { | - | ||||||||||||
171 | return executed 180 times by 2 tests: d_func()->isFinished;return d_func()->isFinished; Executed by:
executed 180 times by 2 tests: return d_func()->isFinished; Executed by:
| 180 | ||||||||||||
172 | } | - | ||||||||||||
173 | QString QDnsLookup::name() const | - | ||||||||||||
174 | { | - | ||||||||||||
175 | return executed 72 times by 1 test: d_func()->name;return d_func()->name; Executed by:
executed 72 times by 1 test: return d_func()->name; Executed by:
| 72 | ||||||||||||
176 | } | - | ||||||||||||
177 | - | |||||||||||||
178 | void QDnsLookup::setName(const QString &name) | - | ||||||||||||
179 | { | - | ||||||||||||
180 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
181 | if (name != d->name
| 16-64 | ||||||||||||
182 | d->name = name; | - | ||||||||||||
183 | nameChanged(name); | - | ||||||||||||
184 | } executed 64 times by 1 test: end of block Executed by:
| 64 | ||||||||||||
185 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||
186 | - | |||||||||||||
187 | - | |||||||||||||
188 | - | |||||||||||||
189 | - | |||||||||||||
190 | - | |||||||||||||
191 | - | |||||||||||||
192 | QDnsLookup::Type QDnsLookup::type() const | - | ||||||||||||
193 | { | - | ||||||||||||
194 | return executed 72 times by 1 test: d_func()->type;return d_func()->type; Executed by:
executed 72 times by 1 test: return d_func()->type; Executed by:
| 72 | ||||||||||||
195 | } | - | ||||||||||||
196 | - | |||||||||||||
197 | void QDnsLookup::setType(Type type) | - | ||||||||||||
198 | { | - | ||||||||||||
199 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
200 | if (type != d->type
| 12-68 | ||||||||||||
201 | d->type = type; | - | ||||||||||||
202 | typeChanged(type); | - | ||||||||||||
203 | } executed 68 times by 1 test: end of block Executed by:
| 68 | ||||||||||||
204 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||
205 | - | |||||||||||||
206 | - | |||||||||||||
207 | - | |||||||||||||
208 | - | |||||||||||||
209 | - | |||||||||||||
210 | - | |||||||||||||
211 | QHostAddress QDnsLookup::nameserver() const | - | ||||||||||||
212 | { | - | ||||||||||||
213 | return never executed: d_func()->nameserver;return d_func()->nameserver; never executed: return d_func()->nameserver; | 0 | ||||||||||||
214 | } | - | ||||||||||||
215 | - | |||||||||||||
216 | void QDnsLookup::setNameserver(const QHostAddress &nameserver) | - | ||||||||||||
217 | { | - | ||||||||||||
218 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
219 | if (nameserver != d->nameserver
| 0 | ||||||||||||
220 | d->nameserver = nameserver; | - | ||||||||||||
221 | nameserverChanged(nameserver); | - | ||||||||||||
222 | } never executed: end of block | 0 | ||||||||||||
223 | } never executed: end of block | 0 | ||||||||||||
224 | - | |||||||||||||
225 | - | |||||||||||||
226 | - | |||||||||||||
227 | - | |||||||||||||
228 | - | |||||||||||||
229 | QList<QDnsDomainNameRecord> QDnsLookup::canonicalNameRecords() const | - | ||||||||||||
230 | { | - | ||||||||||||
231 | return executed 72 times by 1 test: d_func()->reply.canonicalNameRecords;return d_func()->reply.canonicalNameRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.canonicalNameRecords; Executed by:
| 72 | ||||||||||||
232 | } | - | ||||||||||||
233 | - | |||||||||||||
234 | - | |||||||||||||
235 | - | |||||||||||||
236 | - | |||||||||||||
237 | - | |||||||||||||
238 | QList<QDnsHostAddressRecord> QDnsLookup::hostAddressRecords() const | - | ||||||||||||
239 | { | - | ||||||||||||
240 | return executed 92 times by 1 test: d_func()->reply.hostAddressRecords;return d_func()->reply.hostAddressRecords; Executed by:
executed 92 times by 1 test: return d_func()->reply.hostAddressRecords; Executed by:
| 92 | ||||||||||||
241 | } | - | ||||||||||||
242 | QList<QDnsMailExchangeRecord> QDnsLookup::mailExchangeRecords() const | - | ||||||||||||
243 | { | - | ||||||||||||
244 | return executed 72 times by 1 test: d_func()->reply.mailExchangeRecords;return d_func()->reply.mailExchangeRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.mailExchangeRecords; Executed by:
| 72 | ||||||||||||
245 | } | - | ||||||||||||
246 | - | |||||||||||||
247 | - | |||||||||||||
248 | - | |||||||||||||
249 | - | |||||||||||||
250 | - | |||||||||||||
251 | QList<QDnsDomainNameRecord> QDnsLookup::nameServerRecords() const | - | ||||||||||||
252 | { | - | ||||||||||||
253 | return executed 72 times by 1 test: d_func()->reply.nameServerRecords;return d_func()->reply.nameServerRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.nameServerRecords; Executed by:
| 72 | ||||||||||||
254 | } | - | ||||||||||||
255 | - | |||||||||||||
256 | - | |||||||||||||
257 | - | |||||||||||||
258 | - | |||||||||||||
259 | - | |||||||||||||
260 | QList<QDnsDomainNameRecord> QDnsLookup::pointerRecords() const | - | ||||||||||||
261 | { | - | ||||||||||||
262 | return executed 72 times by 1 test: d_func()->reply.pointerRecords;return d_func()->reply.pointerRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.pointerRecords; Executed by:
| 72 | ||||||||||||
263 | } | - | ||||||||||||
264 | QList<QDnsServiceRecord> QDnsLookup::serviceRecords() const | - | ||||||||||||
265 | { | - | ||||||||||||
266 | return executed 72 times by 1 test: d_func()->reply.serviceRecords;return d_func()->reply.serviceRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.serviceRecords; Executed by:
| 72 | ||||||||||||
267 | } | - | ||||||||||||
268 | - | |||||||||||||
269 | - | |||||||||||||
270 | - | |||||||||||||
271 | - | |||||||||||||
272 | - | |||||||||||||
273 | QList<QDnsTextRecord> QDnsLookup::textRecords() const | - | ||||||||||||
274 | { | - | ||||||||||||
275 | return executed 72 times by 1 test: d_func()->reply.textRecords;return d_func()->reply.textRecords; Executed by:
executed 72 times by 1 test: return d_func()->reply.textRecords; Executed by:
| 72 | ||||||||||||
276 | } | - | ||||||||||||
277 | - | |||||||||||||
278 | - | |||||||||||||
279 | - | |||||||||||||
280 | - | |||||||||||||
281 | - | |||||||||||||
282 | - | |||||||||||||
283 | - | |||||||||||||
284 | void QDnsLookup::abort() | - | ||||||||||||
285 | { | - | ||||||||||||
286 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
287 | if (d->runnable
| 0-2 | ||||||||||||
288 | d->runnable = 0; | - | ||||||||||||
289 | d->reply = QDnsLookupReply(); | - | ||||||||||||
290 | d->reply.error = QDnsLookup::OperationCancelledError; | - | ||||||||||||
291 | d->reply.errorString = tr("Operation cancelled"); | - | ||||||||||||
292 | d->isFinished = true; | - | ||||||||||||
293 | finished(); | - | ||||||||||||
294 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
295 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
296 | - | |||||||||||||
297 | - | |||||||||||||
298 | - | |||||||||||||
299 | - | |||||||||||||
300 | - | |||||||||||||
301 | - | |||||||||||||
302 | - | |||||||||||||
303 | void QDnsLookup::lookup() | - | ||||||||||||
304 | { | - | ||||||||||||
305 | QDnsLookupPrivate * const d = d_func(); | - | ||||||||||||
306 | d->isFinished = false; | - | ||||||||||||
307 | d->reply = QDnsLookupReply(); | - | ||||||||||||
308 | d->runnable = new QDnsLookupRunnable(d->type, QUrl::toAce(d->name), d->nameserver); | - | ||||||||||||
309 | connect(d->runnable, qFlagLocation("2""finished(QDnsLookupReply)" "\0" __FILE__ ":" "498"), | - | ||||||||||||
310 | this, qFlagLocation("1""_q_lookupFinished(QDnsLookupReply)" "\0" __FILE__ ":" "499"), | - | ||||||||||||
311 | Qt::BlockingQueuedConnection); | - | ||||||||||||
312 | theDnsLookupThreadPool()->start(d->runnable); | - | ||||||||||||
313 | } executed 101 times by 2 tests: end of block Executed by:
| 101 | ||||||||||||
314 | QDnsDomainNameRecord::QDnsDomainNameRecord() | - | ||||||||||||
315 | : d(new QDnsDomainNameRecordPrivate) | - | ||||||||||||
316 | { | - | ||||||||||||
317 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
318 | - | |||||||||||||
319 | - | |||||||||||||
320 | - | |||||||||||||
321 | - | |||||||||||||
322 | - | |||||||||||||
323 | QDnsDomainNameRecord::QDnsDomainNameRecord(const QDnsDomainNameRecord &other) | - | ||||||||||||
324 | : d(other.d) | - | ||||||||||||
325 | { | - | ||||||||||||
326 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
327 | - | |||||||||||||
328 | - | |||||||||||||
329 | - | |||||||||||||
330 | - | |||||||||||||
331 | - | |||||||||||||
332 | QDnsDomainNameRecord::~QDnsDomainNameRecord() | - | ||||||||||||
333 | { | - | ||||||||||||
334 | } | - | ||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | - | |||||||||||||
338 | - | |||||||||||||
339 | - | |||||||||||||
340 | QString QDnsDomainNameRecord::name() const | - | ||||||||||||
341 | { | - | ||||||||||||
342 | return executed 6 times by 1 test: d->name;return d->name; Executed by:
executed 6 times by 1 test: return d->name; Executed by:
| 6 | ||||||||||||
343 | } | - | ||||||||||||
344 | - | |||||||||||||
345 | - | |||||||||||||
346 | - | |||||||||||||
347 | - | |||||||||||||
348 | - | |||||||||||||
349 | quint32 QDnsDomainNameRecord::timeToLive() const | - | ||||||||||||
350 | { | - | ||||||||||||
351 | return never executed: d->timeToLive;return d->timeToLive; never executed: return d->timeToLive; | 0 | ||||||||||||
352 | } | - | ||||||||||||
353 | - | |||||||||||||
354 | - | |||||||||||||
355 | - | |||||||||||||
356 | - | |||||||||||||
357 | - | |||||||||||||
358 | QString QDnsDomainNameRecord::value() const | - | ||||||||||||
359 | { | - | ||||||||||||
360 | return executed 6 times by 1 test: d->value;return d->value; Executed by:
executed 6 times by 1 test: return d->value; Executed by:
| 6 | ||||||||||||
361 | } | - | ||||||||||||
362 | - | |||||||||||||
363 | - | |||||||||||||
364 | - | |||||||||||||
365 | - | |||||||||||||
366 | - | |||||||||||||
367 | - | |||||||||||||
368 | QDnsDomainNameRecord &QDnsDomainNameRecord::operator=(const QDnsDomainNameRecord &other) | - | ||||||||||||
369 | { | - | ||||||||||||
370 | d = other.d; | - | ||||||||||||
371 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||
372 | } | - | ||||||||||||
373 | QDnsHostAddressRecord::QDnsHostAddressRecord() | - | ||||||||||||
374 | : d(new QDnsHostAddressRecordPrivate) | - | ||||||||||||
375 | { | - | ||||||||||||
376 | } executed 50 times by 2 tests: end of block Executed by:
| 50 | ||||||||||||
377 | - | |||||||||||||
378 | - | |||||||||||||
379 | - | |||||||||||||
380 | - | |||||||||||||
381 | - | |||||||||||||
382 | QDnsHostAddressRecord::QDnsHostAddressRecord(const QDnsHostAddressRecord &other) | - | ||||||||||||
383 | : d(other.d) | - | ||||||||||||
384 | { | - | ||||||||||||
385 | } executed 62 times by 2 tests: end of block Executed by:
| 62 | ||||||||||||
386 | - | |||||||||||||
387 | - | |||||||||||||
388 | - | |||||||||||||
389 | - | |||||||||||||
390 | - | |||||||||||||
391 | QDnsHostAddressRecord::~QDnsHostAddressRecord() | - | ||||||||||||
392 | { | - | ||||||||||||
393 | } | - | ||||||||||||
394 | - | |||||||||||||
395 | - | |||||||||||||
396 | - | |||||||||||||
397 | - | |||||||||||||
398 | - | |||||||||||||
399 | QString QDnsHostAddressRecord::name() const | - | ||||||||||||
400 | { | - | ||||||||||||
401 | return executed 38 times by 1 test: d->name;return d->name; Executed by:
executed 38 times by 1 test: return d->name; Executed by:
| 38 | ||||||||||||
402 | } | - | ||||||||||||
403 | - | |||||||||||||
404 | - | |||||||||||||
405 | - | |||||||||||||
406 | - | |||||||||||||
407 | - | |||||||||||||
408 | quint32 QDnsHostAddressRecord::timeToLive() const | - | ||||||||||||
409 | { | - | ||||||||||||
410 | return never executed: d->timeToLive;return d->timeToLive; never executed: return d->timeToLive; | 0 | ||||||||||||
411 | } | - | ||||||||||||
412 | - | |||||||||||||
413 | - | |||||||||||||
414 | - | |||||||||||||
415 | - | |||||||||||||
416 | - | |||||||||||||
417 | QHostAddress QDnsHostAddressRecord::value() const | - | ||||||||||||
418 | { | - | ||||||||||||
419 | return executed 38 times by 1 test: d->value;return d->value; Executed by:
executed 38 times by 1 test: return d->value; Executed by:
| 38 | ||||||||||||
420 | } | - | ||||||||||||
421 | - | |||||||||||||
422 | - | |||||||||||||
423 | - | |||||||||||||
424 | - | |||||||||||||
425 | - | |||||||||||||
426 | - | |||||||||||||
427 | QDnsHostAddressRecord &QDnsHostAddressRecord::operator=(const QDnsHostAddressRecord &other) | - | ||||||||||||
428 | { | - | ||||||||||||
429 | d = other.d; | - | ||||||||||||
430 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||
431 | } | - | ||||||||||||
432 | QDnsMailExchangeRecord::QDnsMailExchangeRecord() | - | ||||||||||||
433 | : d(new QDnsMailExchangeRecordPrivate) | - | ||||||||||||
434 | { | - | ||||||||||||
435 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||
436 | - | |||||||||||||
437 | - | |||||||||||||
438 | - | |||||||||||||
439 | - | |||||||||||||
440 | - | |||||||||||||
441 | QDnsMailExchangeRecord::QDnsMailExchangeRecord(const QDnsMailExchangeRecord &other) | - | ||||||||||||
442 | : d(other.d) | - | ||||||||||||
443 | { | - | ||||||||||||
444 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||
445 | - | |||||||||||||
446 | - | |||||||||||||
447 | - | |||||||||||||
448 | - | |||||||||||||
449 | - | |||||||||||||
450 | QDnsMailExchangeRecord::~QDnsMailExchangeRecord() | - | ||||||||||||
451 | { | - | ||||||||||||
452 | } | - | ||||||||||||
453 | - | |||||||||||||
454 | - | |||||||||||||
455 | - | |||||||||||||
456 | - | |||||||||||||
457 | - | |||||||||||||
458 | QString QDnsMailExchangeRecord::exchange() const | - | ||||||||||||
459 | { | - | ||||||||||||
460 | return executed 12 times by 1 test: d->exchange;return d->exchange; Executed by:
executed 12 times by 1 test: return d->exchange; Executed by:
| 12 | ||||||||||||
461 | } | - | ||||||||||||
462 | - | |||||||||||||
463 | - | |||||||||||||
464 | - | |||||||||||||
465 | - | |||||||||||||
466 | - | |||||||||||||
467 | QString QDnsMailExchangeRecord::name() const | - | ||||||||||||
468 | { | - | ||||||||||||
469 | return executed 12 times by 1 test: d->name;return d->name; Executed by:
executed 12 times by 1 test: return d->name; Executed by:
| 12 | ||||||||||||
470 | } | - | ||||||||||||
471 | - | |||||||||||||
472 | - | |||||||||||||
473 | - | |||||||||||||
474 | - | |||||||||||||
475 | - | |||||||||||||
476 | quint16 QDnsMailExchangeRecord::preference() const | - | ||||||||||||
477 | { | - | ||||||||||||
478 | return executed 42 times by 1 test: d->preference;return d->preference; Executed by:
executed 42 times by 1 test: return d->preference; Executed by:
| 42 | ||||||||||||
479 | } | - | ||||||||||||
480 | - | |||||||||||||
481 | - | |||||||||||||
482 | - | |||||||||||||
483 | - | |||||||||||||
484 | - | |||||||||||||
485 | quint32 QDnsMailExchangeRecord::timeToLive() const | - | ||||||||||||
486 | { | - | ||||||||||||
487 | return never executed: d->timeToLive;return d->timeToLive; never executed: return d->timeToLive; | 0 | ||||||||||||
488 | } | - | ||||||||||||
489 | - | |||||||||||||
490 | - | |||||||||||||
491 | - | |||||||||||||
492 | - | |||||||||||||
493 | - | |||||||||||||
494 | - | |||||||||||||
495 | QDnsMailExchangeRecord &QDnsMailExchangeRecord::operator=(const QDnsMailExchangeRecord &other) | - | ||||||||||||
496 | { | - | ||||||||||||
497 | d = other.d; | - | ||||||||||||
498 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||
499 | } | - | ||||||||||||
500 | QDnsServiceRecord::QDnsServiceRecord() | - | ||||||||||||
501 | : d(new QDnsServiceRecordPrivate) | - | ||||||||||||
502 | { | - | ||||||||||||
503 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||
504 | - | |||||||||||||
505 | - | |||||||||||||
506 | - | |||||||||||||
507 | - | |||||||||||||
508 | - | |||||||||||||
509 | QDnsServiceRecord::QDnsServiceRecord(const QDnsServiceRecord &other) | - | ||||||||||||
510 | : d(other.d) | - | ||||||||||||
511 | { | - | ||||||||||||
512 | } executed 60 times by 1 test: end of block Executed by:
| 60 | ||||||||||||
513 | - | |||||||||||||
514 | - | |||||||||||||
515 | - | |||||||||||||
516 | - | |||||||||||||
517 | - | |||||||||||||
518 | QDnsServiceRecord::~QDnsServiceRecord() | - | ||||||||||||
519 | { | - | ||||||||||||
520 | } | - | ||||||||||||
521 | - | |||||||||||||
522 | - | |||||||||||||
523 | - | |||||||||||||
524 | - | |||||||||||||
525 | - | |||||||||||||
526 | QString QDnsServiceRecord::name() const | - | ||||||||||||
527 | { | - | ||||||||||||
528 | return executed 18 times by 1 test: d->name;return d->name; Executed by:
executed 18 times by 1 test: return d->name; Executed by:
| 18 | ||||||||||||
529 | } | - | ||||||||||||
530 | - | |||||||||||||
531 | - | |||||||||||||
532 | - | |||||||||||||
533 | - | |||||||||||||
534 | - | |||||||||||||
535 | quint16 QDnsServiceRecord::port() const | - | ||||||||||||
536 | { | - | ||||||||||||
537 | return executed 18 times by 1 test: d->port;return d->port; Executed by:
executed 18 times by 1 test: return d->port; Executed by:
| 18 | ||||||||||||
538 | } | - | ||||||||||||
539 | quint16 QDnsServiceRecord::priority() const | - | ||||||||||||
540 | { | - | ||||||||||||
541 | return executed 116 times by 1 test: d->priority;return d->priority; Executed by:
executed 116 times by 1 test: return d->priority; Executed by:
| 116 | ||||||||||||
542 | } | - | ||||||||||||
543 | - | |||||||||||||
544 | - | |||||||||||||
545 | - | |||||||||||||
546 | - | |||||||||||||
547 | - | |||||||||||||
548 | QString QDnsServiceRecord::target() const | - | ||||||||||||
549 | { | - | ||||||||||||
550 | return executed 18 times by 1 test: d->target;return d->target; Executed by:
executed 18 times by 1 test: return d->target; Executed by:
| 18 | ||||||||||||
551 | } | - | ||||||||||||
552 | - | |||||||||||||
553 | - | |||||||||||||
554 | - | |||||||||||||
555 | - | |||||||||||||
556 | - | |||||||||||||
557 | quint32 QDnsServiceRecord::timeToLive() const | - | ||||||||||||
558 | { | - | ||||||||||||
559 | return never executed: d->timeToLive;return d->timeToLive; never executed: return d->timeToLive; | 0 | ||||||||||||
560 | } | - | ||||||||||||
561 | quint16 QDnsServiceRecord::weight() const | - | ||||||||||||
562 | { | - | ||||||||||||
563 | return executed 74 times by 1 test: d->weight;return d->weight; Executed by:
executed 74 times by 1 test: return d->weight; Executed by:
| 74 | ||||||||||||
564 | } | - | ||||||||||||
565 | - | |||||||||||||
566 | - | |||||||||||||
567 | - | |||||||||||||
568 | - | |||||||||||||
569 | - | |||||||||||||
570 | - | |||||||||||||
571 | QDnsServiceRecord &QDnsServiceRecord::operator=(const QDnsServiceRecord &other) | - | ||||||||||||
572 | { | - | ||||||||||||
573 | d = other.d; | - | ||||||||||||
574 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||
575 | } | - | ||||||||||||
576 | QDnsTextRecord::QDnsTextRecord() | - | ||||||||||||
577 | : d(new QDnsTextRecordPrivate) | - | ||||||||||||
578 | { | - | ||||||||||||
579 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
580 | - | |||||||||||||
581 | - | |||||||||||||
582 | - | |||||||||||||
583 | - | |||||||||||||
584 | - | |||||||||||||
585 | QDnsTextRecord::QDnsTextRecord(const QDnsTextRecord &other) | - | ||||||||||||
586 | : d(other.d) | - | ||||||||||||
587 | { | - | ||||||||||||
588 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
589 | - | |||||||||||||
590 | - | |||||||||||||
591 | - | |||||||||||||
592 | - | |||||||||||||
593 | - | |||||||||||||
594 | QDnsTextRecord::~QDnsTextRecord() | - | ||||||||||||
595 | { | - | ||||||||||||
596 | } | - | ||||||||||||
597 | - | |||||||||||||
598 | - | |||||||||||||
599 | - | |||||||||||||
600 | - | |||||||||||||
601 | - | |||||||||||||
602 | QString QDnsTextRecord::name() const | - | ||||||||||||
603 | { | - | ||||||||||||
604 | return executed 8 times by 1 test: d->name;return d->name; Executed by:
executed 8 times by 1 test: return d->name; Executed by:
| 8 | ||||||||||||
605 | } | - | ||||||||||||
606 | - | |||||||||||||
607 | - | |||||||||||||
608 | - | |||||||||||||
609 | - | |||||||||||||
610 | - | |||||||||||||
611 | quint32 QDnsTextRecord::timeToLive() const | - | ||||||||||||
612 | { | - | ||||||||||||
613 | return never executed: d->timeToLive;return d->timeToLive; never executed: return d->timeToLive; | 0 | ||||||||||||
614 | } | - | ||||||||||||
615 | - | |||||||||||||
616 | - | |||||||||||||
617 | - | |||||||||||||
618 | - | |||||||||||||
619 | - | |||||||||||||
620 | QList<QByteArray> QDnsTextRecord::values() const | - | ||||||||||||
621 | { | - | ||||||||||||
622 | return executed 8 times by 1 test: d->values;return d->values; Executed by:
executed 8 times by 1 test: return d->values; Executed by:
| 8 | ||||||||||||
623 | } | - | ||||||||||||
624 | - | |||||||||||||
625 | - | |||||||||||||
626 | - | |||||||||||||
627 | - | |||||||||||||
628 | - | |||||||||||||
629 | - | |||||||||||||
630 | QDnsTextRecord &QDnsTextRecord::operator=(const QDnsTextRecord &other) | - | ||||||||||||
631 | { | - | ||||||||||||
632 | d = other.d; | - | ||||||||||||
633 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||
634 | } | - | ||||||||||||
635 | - | |||||||||||||
636 | - | |||||||||||||
637 | - | |||||||||||||
638 | - | |||||||||||||
639 | - | |||||||||||||
640 | - | |||||||||||||
641 | - | |||||||||||||
642 | void QDnsLookupPrivate::_q_lookupFinished(const QDnsLookupReply &_reply) | - | ||||||||||||
643 | { | - | ||||||||||||
644 | QDnsLookup * const q = q_func(); | - | ||||||||||||
645 | if (runnable == q->sender()
| 2-88 | ||||||||||||
646 | - | |||||||||||||
647 | - | |||||||||||||
648 | - | |||||||||||||
649 | reply = _reply; | - | ||||||||||||
650 | runnable = 0; | - | ||||||||||||
651 | isFinished = true; | - | ||||||||||||
652 | q->finished(); | - | ||||||||||||
653 | } executed 88 times by 2 tests: end of block Executed by:
| 88 | ||||||||||||
654 | } executed 90 times by 2 tests: end of block Executed by:
| 90 | ||||||||||||
655 | - | |||||||||||||
656 | void QDnsLookupRunnable::run() | - | ||||||||||||
657 | { | - | ||||||||||||
658 | QDnsLookupReply reply; | - | ||||||||||||
659 | - | |||||||||||||
660 | - | |||||||||||||
661 | if (requestName.isEmpty()
| 16-84 | ||||||||||||
662 | reply.error = QDnsLookup::InvalidRequestError; | - | ||||||||||||
663 | reply.errorString = tr("Invalid domain name"); | - | ||||||||||||
664 | finished(reply); | - | ||||||||||||
665 | return; executed 16 times by 1 test: return; Executed by:
| 16 | ||||||||||||
666 | } | - | ||||||||||||
667 | - | |||||||||||||
668 | - | |||||||||||||
669 | query(requestType, requestName, nameserver, &reply); | - | ||||||||||||
670 | - | |||||||||||||
671 | - | |||||||||||||
672 | if (!theDnsLookupSeedStorage()->hasLocalData()
| 23-61 | ||||||||||||
673 | qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) ^ reinterpret_cast<quintptr>(this)); | - | ||||||||||||
674 | theDnsLookupSeedStorage()->setLocalData(new bool(true)); | - | ||||||||||||
675 | } executed 23 times by 2 tests: end of block Executed by:
| 23 | ||||||||||||
676 | qt_qdnsmailexchangerecord_sort(reply.mailExchangeRecords); | - | ||||||||||||
677 | qt_qdnsservicerecord_sort(reply.serviceRecords); | - | ||||||||||||
678 | - | |||||||||||||
679 | finished(reply); | - | ||||||||||||
680 | } executed 84 times by 2 tests: end of block Executed by:
| 84 | ||||||||||||
681 | - | |||||||||||||
682 | QDnsLookupThreadPool::QDnsLookupThreadPool() | - | ||||||||||||
683 | : signalsConnected(false) | - | ||||||||||||
684 | { | - | ||||||||||||
685 | - | |||||||||||||
686 | setMaxThreadCount(5); | - | ||||||||||||
687 | } executed 2 times by 2 tests: end of block Executed by:
| 2 | ||||||||||||
688 | - | |||||||||||||
689 | void QDnsLookupThreadPool::start(QRunnable *runnable) | - | ||||||||||||
690 | { | - | ||||||||||||
691 | - | |||||||||||||
692 | if (!signalsConnected
| 22-79 | ||||||||||||
693 | QMutexLocker signalsLocker(&signalsMutex); | - | ||||||||||||
694 | if (!signalsConnected
| 0-22 | ||||||||||||
695 | QCoreApplication *app = QCoreApplication::instance(); | - | ||||||||||||
696 | if (!app
| 1-21 | ||||||||||||
697 | QMessageLogger(__FILE__, 1033, __PRETTY_FUNCTION__).warning("QDnsLookup requires a QCoreApplication"); | - | ||||||||||||
698 | delete runnable; | - | ||||||||||||
699 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||
700 | } | - | ||||||||||||
701 | - | |||||||||||||
702 | moveToThread(app->thread()); | - | ||||||||||||
703 | connect(app, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "1039"), | - | ||||||||||||
704 | qFlagLocation("1""_q_applicationDestroyed()" "\0" __FILE__ ":" "1040"), Qt::DirectConnection); | - | ||||||||||||
705 | signalsConnected = true; | - | ||||||||||||
706 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||
707 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||
708 | - | |||||||||||||
709 | QThreadPool::start(runnable); | - | ||||||||||||
710 | } executed 100 times by 2 tests: end of block Executed by:
| 100 | ||||||||||||
711 | - | |||||||||||||
712 | void QDnsLookupThreadPool::_q_applicationDestroyed() | - | ||||||||||||
713 | { | - | ||||||||||||
714 | waitForDone(); | - | ||||||||||||
715 | signalsConnected = false; | - | ||||||||||||
716 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||
717 | - | |||||||||||||
718 | - | |||||||||||||
719 | - | |||||||||||||
Switch to Source code | Preprocessed file |