Branch Coverage

Native.xs
Criterion Covered Total %
branch 140 258 54.2


line true false branch
45 0 0 if (*found) {
49 0 0 for (i=0; i < info->dlpi_phnum; i++) {
50 0 0 if (instr(info->dlpi_name, "libnss_files") != NULL) {
107 277 37 if (!arg->pool)
111 16 298 if (arg->self->notify_on_begin)
117 15 299 if (arg->extra) arg->self->extra_threads_cnt--;
130 52 0 while (sem_wait(&self->semaphore) == 0) {
133 37 15 if (arg != NULL) self->busy_threads++;
136 15 37 if (arg == NULL) {
152 48 284 if (queue_size(self->tout_queue)) {
157 48 48 while (!queue_iterator_end(it)) {
160 0 48 if (res == NULL) {
164 48 0 if (force || res->arg) {
9 39 if (force || res->arg) {
166 6 3 if (!res->error && res->hostinfo)
6 0 if (!res->error && res->hostinfo)
171 9 0 if (res->arg) {
172 9 0 if (res->arg->hints) free(res->arg->hints);
173 9 0 if (res->arg->host) Safefree(res->arg->host);
174 0 9 if (res->arg->service) Safefree(res->arg->service);
204 0 5 if (queue_size(DNS_instances) == 0) {
210 5 5 while (!queue_iterator_end(it)) {
213 3 2 if (self->pool) DNS_lock_semaphore(&self->semaphore);
220 0 3 if (queue_size(DNS_instances) == 0) {
226 3 3 while (!queue_iterator_end(it)) {
229 2 1 if (self->pool) DNS_unlock_semaphore(&self->semaphore);
239 1 1 for (i=0; ipool; i++) {
241 1 0 if (rc == 0) {
251 0 2 if (queue_size(DNS_instances) == 0) {
258 2 2 while (!queue_iterator_end(it)) {
261 1 1 if (self->pool) DNS_unlock_semaphore(&self->semaphore);
271 1 1 if (self->pool) {
295 0 16 if (items % 2 == 0)
314 15 16 for (i=1; i
315 15 0 opt = SvPV_nolen(ST(i));
317 9 6 if (strEQ(opt, "pool")) {
318 9 0 self->pool = SvIV(ST(i+1));
319 0 9 if (self->pool < 0) self->pool = 0;
321 3 3 else if (strEQ(opt, "extra_thread")) {
322 3 0 self->extra_thread = SvIV(ST(i+1));
324 3 0 else if (strEQ(opt, "notify_on_begin")) {
325 3 0 self->notify_on_begin = SvIV(ST(i+1));
328 0 0 warn("unsupported option: %s", SvPV_nolen(ST(i)));
335 0 16 if (rc != 0) {
341 0 16 if (rc != 0) {
346 0 16 if (rc != 0) {
355 5 11 if (DNS_instances == NULL) {
359 0 5 if (rc != 0) {
366 9 7 if (self->pool) {
367 0 9 if (sem_init(&self->semaphore, 0, 0) != 0) {
377 15 9 for (i=0; ipool; i++) {
379 15 0 if (rc == 0) {
387 0 9 if (j == 0) {
402 0 0 if (attr_ok) pthread_attr_destroy(&self->thread_attrs);
403 0 0 if (mutex_ok) pthread_mutex_destroy(&self->mutex);
404 0 0 if (sem_ok) sem_destroy(&self->semaphore);
405 0 0 if (self->threads_pool) free(self->threads_pool);
425 0 314 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, fd) != 0)
431 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) : "";
434 233 81 if (SvOK(sv_hints)) {
233 0 if (SvOK(sv_hints)) {
0 233 if (SvOK(sv_hints)) {
436 81 0 if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) {
0 81 if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) {
454 45 36 if (flags_ptr != NULL) {
455 45 0 hints->ai_flags = SvIV(*flags_ptr);
459 81 0 if (family_ptr != NULL) {
460 81 0 hints->ai_family = SvIV(*family_ptr);
464 81 0 if (socktype_ptr != NULL) {
465 81 0 hints->ai_socktype = SvIV(*socktype_ptr);
469 0 81 if (protocol_ptr != NULL) {
470 0 0 hints->ai_protocol = SvIV(*protocol_ptr);
484 314 0 arg->host = strlen(host) ? savepv(host) : NULL;
485 0 314 arg->service = strlen(service) ? savepv(service) : NULL;
494 52 262 if (self->pool) {
495 26 26 if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) {
11 15 if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) {
0 11 if (self->busy_threads == self->pool && (self->extra_thread || queue_size(self->tout_queue) > self->extra_threads_cnt)) {
507 52 262 if (!self->pool || arg->extra) {
15 37 if (!self->pool || arg->extra) {
510 0 277 if (rc != 0) {
511 0 0 if (arg->host) Safefree(arg->host);
512 0 0 if (arg->service) Safefree(arg->service);
515 0 0 if (hints) free(hints);
537 12 305 if (res == NULL) croak("attempt to get result which doesn't exists");
538 0 305 if (!res->arg) {
545 0 305 XPUSHs(sv_2mortal(newSViv(res->type)));
548 29 276 sv_setpv(err, res->error ? gai_strerror(res->error) : "");
550 0 305 XPUSHs(sv_2mortal(err));
552 276 29 if (!res->error) {
554 1386 276 for (info = res->hostinfo; info != NULL; info = info->ai_next) {
560 24 1362 hv_store(hv_info, "canonname", 9, info->ai_canonname ? newSVpv(info->ai_canonname, 0) : newSV(0), 0);
561 0 1386 XPUSHs(sv_2mortal(newRV_noinc((SV*)hv_info)));
564 276 0 if (res->hostinfo) freeaddrinfo(res->hostinfo);
569 72 233 if (res->arg->hints) free(res->arg->hints);
570 305 0 if (res->arg->host) Safefree(res->arg->host);
571 0 305 if (res->arg->service) Safefree(res->arg->service);
581 0 9 if (bstree_get(self->fd_map, fd) == NULL) {
589 0 9 if (unknown)
595 0 16 if (PERL_GET_THX != self->perl) {
600 9 7 if (self->pool) {
602 0 9 if (queue_size(self->in_queue) > 0) {
604 0 0 if (!PL_dirty)
610 0 0 while (!queue_iterator_end(it)) {
623 15 9 for (i=0; ipool; i++) {
629 15 9 for (i=0; ipool; i++) {
646 0 16 if (bstree_size(self->fd_map) > 0) {
647 0 0 if (!PL_dirty)
654 0 0 for (i=0, l=bstree_size(self->fd_map); i
657 0 0 if (!res->dequeued) {
658 0 0 for (j=0; j<2; j++) {
661 0 0 if (buf[0] == '2') break;
664 0 0 if (!res->error && res->hostinfo) freeaddrinfo(res->hostinfo);
0 0 if (!res->error && res->hostinfo) freeaddrinfo(res->hostinfo);
665 0 0 if (res->arg->hints) free(res->arg->hints);
666 0 0 if (res->arg->host) Safefree(res->arg->host);
667 0 0 if (res->arg->service) Safefree(res->arg->service);
680 16 0 while (!queue_iterator_end(it)) {
681 16 0 if (queue_at(DNS_instances, it) == self) {
699 0 0 char *address = SvPV(sv_address, len);
700 0 0 if (len != 16)
708 0 0 XPUSHs(sv_2mortal(newSVpvn((char*) addr, sizeof(struct sockaddr_in6))));
714 6 0 char *addr = SvPV(sv_addr, len);
715 0 6 if (len != sizeof(struct sockaddr_in6))
719 0 6 XPUSHs(sv_2mortal(newSViv(struct_addr->sin6_port)));
720 0 6 XPUSHs(sv_2mortal(newSVpvn((char*)struct_addr->sin6_addr.s6_addr, 16)));