line |
true |
false |
branch |
44
|
0 |
0 |
if (*found) { |
48
|
0 |
0 |
for (i=0; i < info->dlpi_phnum; i++) { |
49
|
0 |
0 |
if (instr(info->dlpi_name, "libnss_files") != NULL) { |
106
|
280 |
34 |
if (!arg->pool) |
110
|
16 |
298 |
if (arg->self->notify_on_begin) |
116
|
18 |
296 |
if (arg->extra) arg->self->extra_threads_cnt--; |
129
|
49 |
0 |
while (sem_wait(&self->semaphore) == 0) { |
132
|
34 |
15 |
if (arg != NULL) self->busy_threads++; |
135
|
15 |
34 |
if (arg == NULL) { |
151
|
48 |
284 |
if (queue_size(self->tout_queue)) { |
156
|
48 |
48 |
while (!queue_iterator_end(it)) { |
159
|
0 |
48 |
if (res == NULL) { |
163
|
48 |
0 |
if (force || res->arg) { |
|
9 |
39 |
if (force || res->arg) { |
165
|
6 |
3 |
if (!res->error && res->hostinfo) |
|
6 |
0 |
if (!res->error && res->hostinfo) |
170
|
9 |
0 |
if (res->arg) { |
171
|
9 |
0 |
if (res->arg->hints) free(res->arg->hints); |
172
|
9 |
0 |
if (res->arg->host) Safefree(res->arg->host); |
173
|
0 |
9 |
if (res->arg->service) Safefree(res->arg->service); |
203
|
0 |
5 |
if (queue_size(DNS_instances) == 0) { |
209
|
5 |
5 |
while (!queue_iterator_end(it)) { |
212
|
3 |
2 |
if (self->pool) DNS_lock_semaphore(&self->semaphore); |
219
|
0 |
3 |
if (queue_size(DNS_instances) == 0) { |
225
|
3 |
3 |
while (!queue_iterator_end(it)) { |
228
|
2 |
1 |
if (self->pool) DNS_unlock_semaphore(&self->semaphore); |
238
|
1 |
1 |
for (i=0; ipool; i++) { |
240
|
1 |
0 |
if (rc == 0) { |
250
|
0 |
2 |
if (queue_size(DNS_instances) == 0) { |
257
|
2 |
2 |
while (!queue_iterator_end(it)) { |
260
|
1 |
1 |
if (self->pool) DNS_unlock_semaphore(&self->semaphore); |
270
|
1 |
1 |
if (self->pool) { |
294
|
0 |
16 |
if (items % 2 == 0) |
313
|
15 |
16 |
for (i=1; i
|
314
|
15 |
0 |
opt = SvPV_nolen(ST(i)); |
316
|
9 |
6 |
if (strEQ(opt, "pool")) { |
317
|
9 |
0 |
self->pool = SvIV(ST(i+1)); |
318
|
0 |
9 |
if (self->pool < 0) self->pool = 0; |
320
|
3 |
3 |
else if (strEQ(opt, "extra_thread")) { |
321
|
3 |
0 |
self->extra_thread = SvIV(ST(i+1)); |
323
|
3 |
0 |
else if (strEQ(opt, "notify_on_begin")) { |
324
|
3 |
0 |
self->notify_on_begin = SvIV(ST(i+1)); |
327
|
0 |
0 |
warn("unsupported option: %s", SvPV_nolen(ST(i))); |
334
|
0 |
16 |
if (rc != 0) { |
340
|
0 |
16 |
if (rc != 0) { |
345
|
0 |
16 |
if (rc != 0) { |
354
|
5 |
11 |
if (DNS_instances == NULL) { |
358
|
0 |
5 |
if (rc != 0) { |
365
|
9 |
7 |
if (self->pool) { |
366
|
0 |
9 |
if (sem_init(&self->semaphore, 0, 0) != 0) { |
376
|
15 |
9 |
for (i=0; ipool; i++) { |
378
|
15 |
0 |
if (rc == 0) { |
386
|
0 |
9 |
if (j == 0) { |
401
|
0 |
0 |
if (attr_ok) pthread_attr_destroy(&self->thread_attrs); |
402
|
0 |
0 |
if (mutex_ok) pthread_mutex_destroy(&self->mutex); |
403
|
0 |
0 |
if (sem_ok) sem_destroy(&self->semaphore); |
404
|
0 |
0 |
if (self->threads_pool) free(self->threads_pool); |
424
|
0 |
314 |
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, PF_UNSPEC, fd) != 0) |
427
|
314 |
0 |
char *service = SvOK(sv_service) ? SvPV_nolen(sv_service) : ""; |
|
314 |
0 |
char *service = SvOK(sv_service) ? SvPV_nolen(sv_service) : ""; |
|
0 |
314 |
char *service = SvOK(sv_service) ? SvPV_nolen(sv_service) : ""; |
|
0 |
0 |
char *service = SvOK(sv_service) ? SvPV_nolen(sv_service) : ""; |
430
|
233 |
81 |
if (SvOK(sv_hints)) { |
|
233 |
0 |
if (SvOK(sv_hints)) { |
|
0 |
233 |
if (SvOK(sv_hints)) { |
432
|
81 |
0 |
if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) { |
|
0 |
81 |
if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) { |
450
|
45 |
36 |
if (flags_ptr != NULL) { |
451
|
45 |
0 |
hints->ai_flags = SvIV(*flags_ptr); |
455
|
81 |
0 |
if (family_ptr != NULL) { |
456
|
81 |
0 |
hints->ai_family = SvIV(*family_ptr); |
460
|
81 |
0 |
if (socktype_ptr != NULL) { |
461
|
81 |
0 |
hints->ai_socktype = SvIV(*socktype_ptr); |
465
|
0 |
81 |
if (protocol_ptr != NULL) { |
466
|
0 |
0 |
hints->ai_protocol = SvIV(*protocol_ptr); |
480
|
314 |
0 |
arg->host = strlen(host) ? savepv(host) : NULL; |
481
|
0 |
314 |
arg->service = strlen(service) ? savepv(service) : NULL; |
490
|
52 |
262 |
if (self->pool) { |
491
|
35 |
17 |
if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) { |
|
20 |
15 |
if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) { |
|
3 |
17 |
if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) { |
503
|
52 |
262 |
if (!self->pool || arg->extra) { |
|
18 |
34 |
if (!self->pool || arg->extra) { |
506
|
0 |
280 |
if (rc != 0) { |
507
|
0 |
0 |
if (arg->host) Safefree(arg->host); |
508
|
0 |
0 |
if (arg->service) Safefree(arg->service); |
511
|
0 |
0 |
if (hints) free(hints); |
533
|
12 |
305 |
if (res == NULL) croak("attempt to get result which doesn't exists"); |
534
|
0 |
305 |
if (!res->arg) { |
541
|
0 |
305 |
XPUSHs(sv_2mortal(newSViv(res->type))); |
544
|
29 |
276 |
sv_setpv(err, res->error ? gai_strerror(res->error) : ""); |
546
|
0 |
305 |
XPUSHs(sv_2mortal(err)); |
548
|
276 |
29 |
if (!res->error) { |
550
|
1401 |
276 |
for (info = res->hostinfo; info != NULL; info = info->ai_next) { |
556
|
24 |
1377 |
hv_store(hv_info, "canonname", 9, info->ai_canonname ? newSVpv(info->ai_canonname, 0) : newSV(0), 0); |
557
|
0 |
1401 |
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv_info))); |
560
|
276 |
0 |
if (res->hostinfo) freeaddrinfo(res->hostinfo); |
565
|
72 |
233 |
if (res->arg->hints) free(res->arg->hints); |
566
|
305 |
0 |
if (res->arg->host) Safefree(res->arg->host); |
567
|
0 |
305 |
if (res->arg->service) Safefree(res->arg->service); |
577
|
0 |
9 |
if (bstree_get(self->fd_map, fd) == NULL) { |
585
|
0 |
9 |
if (unknown) |
591
|
0 |
16 |
if (PERL_GET_THX != self->perl) { |
596
|
9 |
7 |
if (self->pool) { |
598
|
0 |
9 |
if (queue_size(self->in_queue) > 0) { |
600
|
0 |
0 |
if (!PL_dirty) |
606
|
0 |
0 |
while (!queue_iterator_end(it)) { |
619
|
15 |
9 |
for (i=0; ipool; i++) { |
625
|
15 |
9 |
for (i=0; ipool; i++) { |
642
|
0 |
16 |
if (bstree_size(self->fd_map) > 0) { |
643
|
0 |
0 |
if (!PL_dirty) |
650
|
0 |
0 |
for (i=0, l=bstree_size(self->fd_map); i
|
653
|
0 |
0 |
if (!res->dequeued) { |
654
|
0 |
0 |
for (j=0; j<2; j++) { |
657
|
0 |
0 |
if (buf[0] == '2') break; |
660
|
0 |
0 |
if (!res->error && res->hostinfo) freeaddrinfo(res->hostinfo); |
|
0 |
0 |
if (!res->error && res->hostinfo) freeaddrinfo(res->hostinfo); |
661
|
0 |
0 |
if (res->arg->hints) free(res->arg->hints); |
662
|
0 |
0 |
if (res->arg->host) Safefree(res->arg->host); |
663
|
0 |
0 |
if (res->arg->service) Safefree(res->arg->service); |
676
|
16 |
0 |
while (!queue_iterator_end(it)) { |
677
|
16 |
0 |
if (queue_at(DNS_instances, it) == self) { |
695
|
0 |
0 |
char *address = SvPV(sv_address, len); |
696
|
0 |
0 |
if (len != 16) |
704
|
0 |
0 |
XPUSHs(sv_2mortal(newSVpvn((char*) addr, sizeof(struct sockaddr_in6)))); |
710
|
6 |
0 |
char *addr = SvPV(sv_addr, len); |
711
|
0 |
6 |
if (len != sizeof(struct sockaddr_in6)) |
715
|
0 |
6 |
XPUSHs(sv_2mortal(newSViv(struct_addr->sin6_port))); |
716
|
0 |
6 |
XPUSHs(sv_2mortal(newSVpvn((char*)struct_addr->sin6_addr.s6_addr, 16))); |