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