| 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 | 29 | 266 | if (--self->active_threads_cnt == 0) { | 
 
| 118 | 280 | 34 | if (!queued) | 
 
| 122 | 16 | 298 | if (self->notify_on_begin) | 
 
| 125 | 0 | 314 | if (arg->res->gai_error == EAI_SYSTEM) | 
 
| 130 | 18 | 296 | if (arg->extra) self->extra_threads_cnt--; | 
 
| 134 | 280 | 34 | if (!queued) DNS_on_thread_finish(self); | 
 
| 144 | 49 | 0 | while (sem_wait(&self->semaphore) == 0) { | 
 
| 147 | 34 | 15 | if (arg != NULL) self->busy_threads++; | 
 
| 150 | 15 | 34 | if (arg == NULL) { | 
 
| 173 | 0 | 0 | while (sem_wait(&self->semaphore) == 0) { | 
 
| 178 | 0 | 0 | if (arg == NULL) { | 
 
| 185 | 0 | 0 | if (!queue_size(self->in_queue) || (self->pool && self->busy_threads < self->pool)) { | 
 
|  | 0 | 0 | if (!queue_size(self->in_queue) || (self->pool && self->busy_threads < self->pool)) { | 
 
|  | 0 | 0 | if (!queue_size(self->in_queue) || (self->pool && self->busy_threads < self->pool)) { | 
 
| 191 | 0 | 0 | if (stop) | 
 
| 200 | 48 | 284 | if (queue_size(self->tout_queue)) { | 
 
| 205 | 48 | 48 | while (!queue_iterator_end(it)) { | 
 
| 208 | 0 | 48 | if (res == NULL) { | 
 
| 212 | 48 | 0 | if (force || res->arg) { | 
 
|  | 9 | 39 | if (force || res->arg) { | 
 
| 214 | 9 | 0 | if (!res->gai_error && res->hostinfo) | 
 
|  | 9 | 0 | if (!res->gai_error && res->hostinfo) | 
 
| 219 | 9 | 0 | if (res->arg) { | 
 
| 220 | 9 | 0 | if (res->arg->hints)   free(res->arg->hints); | 
 
| 221 | 9 | 0 | if (res->arg->host)    Safefree(res->arg->host); | 
 
| 222 | 0 | 9 | if (res->arg->service) Safefree(res->arg->service); | 
 
| 252 | 0 | 5 | if (queue_size(DNS_instances) == 0) { | 
 
| 258 | 5 | 5 | while (!queue_iterator_end(it)) { | 
 
| 261 | 3 | 2 | if (self->pool) DNS_lock_semaphore(&self->semaphore); | 
 
| 268 | 0 | 3 | if (queue_size(DNS_instances) == 0) { | 
 
| 274 | 3 | 3 | while (!queue_iterator_end(it)) { | 
 
| 277 | 2 | 1 | if (self->pool) DNS_unlock_semaphore(&self->semaphore); | 
 
| 287 | 1 | 1 | for (i=0; ipool; i++) { | 
 
| 289 | 1 | 0 | if (rc == 0) { | 
 
| 299 | 0 | 2 | if (queue_size(DNS_instances) == 0) { | 
 
| 306 | 2 | 2 | while (!queue_iterator_end(it)) { | 
 
| 309 | 1 | 1 | if (self->pool) DNS_unlock_semaphore(&self->semaphore); | 
 
| 319 | 1 | 1 | if (self->pool) { | 
 
| 343 | 0 | 16 | if (items % 2 == 0) | 
 
| 362 | 15 | 16 | for (i=1; i | 
 
| 363 | 15 | 0 | opt = SvPV_nolen(ST(i)); | 
 
| 365 | 9 | 6 | if (strEQ(opt, "pool")) { | 
 
| 366 | 9 | 0 | self->pool = SvIV(ST(i+1)); | 
 
| 367 | 0 | 9 | if (self->pool < 0) self->pool = 0; | 
 
| 369 | 3 | 3 | else if (strEQ(opt, "extra_thread")) { | 
 
| 370 | 3 | 0 | self->extra_thread = SvIV(ST(i+1)); | 
 
| 372 | 3 | 0 | else if (strEQ(opt, "notify_on_begin")) { | 
 
| 373 | 3 | 0 | self->notify_on_begin = SvIV(ST(i+1)); | 
 
| 376 | 0 | 0 | warn("unsupported option: %s", SvPV_nolen(ST(i))); | 
 
| 383 | 0 | 16 | if (rc != 0) { | 
 
| 389 | 0 | 16 | if (rc != 0) { | 
 
| 394 | 0 | 16 | if (rc != 0) { | 
 
| 401 | 0 | 16 | if (rc != 0) { | 
 
| 409 | 5 | 11 | if (DNS_instances == NULL) { | 
 
| 413 | 0 | 5 | if (rc != 0) { | 
 
| 420 | 9 | 7 | if (self->pool) { | 
 
| 421 | 0 | 9 | if (sem_init(&self->semaphore, 0, 0) != 0) { | 
 
| 429 | 15 | 9 | for (i=0; ipool; i++) { | 
 
| 431 | 15 | 0 | if (rc == 0) { | 
 
| 440 | 0 | 9 | if (j == 0) { | 
 
| 455 | 0 | 0 | if (attr_ok) pthread_attr_destroy(&self->thread_attrs); | 
 
| 456 | 0 | 0 | if (mutex_ok) pthread_mutex_destroy(&self->mutex); | 
 
| 457 | 0 | 0 | if (cv_ok) pthread_cond_destroy(&self->cv); | 
 
| 458 | 0 | 0 | if (sem_ok) sem_destroy(&self->semaphore); | 
 
| 478 | 0 | 314 | if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, fd) != 0) | 
 
| 484 | 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) : ""; | 
 
| 487 | 233 | 81 | if (SvOK(sv_hints)) { | 
 
|  | 233 | 0 | if (SvOK(sv_hints)) { | 
 
|  | 0 | 233 | if (SvOK(sv_hints)) { | 
 
| 489 | 81 | 0 | if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) { | 
 
|  | 0 | 81 | if (!SvROK(sv_hints) || SvTYPE(SvRV(sv_hints)) != SVt_PVHV) { | 
 
| 507 | 45 | 36 | if (flags_ptr != NULL) { | 
 
| 508 | 45 | 0 | hints->ai_flags = SvIV(*flags_ptr); | 
 
| 512 | 81 | 0 | if (family_ptr != NULL) { | 
 
| 513 | 81 | 0 | hints->ai_family = SvIV(*family_ptr); | 
 
| 517 | 81 | 0 | if (socktype_ptr != NULL) { | 
 
| 518 | 81 | 0 | hints->ai_socktype = SvIV(*socktype_ptr); | 
 
| 522 | 0 | 81 | if (protocol_ptr != NULL) { | 
 
| 523 | 0 | 0 | hints->ai_protocol = SvIV(*protocol_ptr); | 
 
| 538 | 314 | 0 | arg->host = strlen(host) ? savepv(host) : NULL; | 
 
| 539 | 0 | 314 | arg->service = strlen(service) ? savepv(service) : NULL; | 
 
| 548 | 52 | 262 | if (self->pool) { | 
 
| 549 | 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)) { | 
 
| 561 | 52 | 262 | if (!self->pool || arg->extra) { | 
 
|  | 18 | 34 | if (!self->pool || arg->extra) { | 
 
| 566 | 280 | 0 | if (rc == 0) { | 
 
| 572 | 0 | 0 | if (arg->host)    Safefree(arg->host); | 
 
| 573 | 0 | 0 | if (arg->service) Safefree(arg->service); | 
 
| 576 | 0 | 0 | if (hints) free(hints); | 
 
| 598 | 12 | 305 | if (res == NULL) croak("attempt to get result which doesn't exists"); | 
 
| 599 | 0 | 305 | if (!res->arg) { | 
 
| 606 | 0 | 305 | XPUSHs(sv_2mortal(newSViv(res->type))); | 
 
| 609 | 26 | 279 | sv_setpv(err, res->gai_error ? gai_strerror(res->gai_error) : ""); | 
 
| 610 | 0 | 305 | if (res->gai_error == EAI_SYSTEM) | 
 
| 613 | 0 | 305 | XPUSHs(sv_2mortal(err)); | 
 
| 615 | 279 | 26 | if (!res->gai_error) { | 
 
| 617 | 1389 | 279 | for (info = res->hostinfo; info != NULL; info = info->ai_next) { | 
 
| 623 | 30 | 1359 | hv_store(hv_info, "canonname", 9, info->ai_canonname ? newSVpv(info->ai_canonname, 0) : newSV(0), 0); | 
 
| 624 | 0 | 1389 | XPUSHs(sv_2mortal(newRV_noinc((SV*)hv_info))); | 
 
| 627 | 279 | 0 | if (res->hostinfo) freeaddrinfo(res->hostinfo); | 
 
| 632 | 72 | 233 | if (res->arg->hints)   free(res->arg->hints); | 
 
| 633 | 305 | 0 | if (res->arg->host)    Safefree(res->arg->host); | 
 
| 634 | 0 | 305 | if (res->arg->service) Safefree(res->arg->service); | 
 
| 644 | 0 | 9 | if (bstree_get(self->fd_map, fd) == NULL) { | 
 
| 652 | 0 | 9 | if (unknown) | 
 
| 658 | 0 | 16 | if (PERL_GET_THX != self->perl) { | 
 
| 663 | 9 | 7 | if (self->pool) { | 
 
| 665 | 0 | 9 | if (queue_size(self->in_queue) > 0) { | 
 
| 667 | 0 | 0 | if (!PL_dirty) | 
 
| 673 | 0 | 0 | while (!queue_iterator_end(it)) { | 
 
| 686 | 15 | 9 | for (i=0; ipool; i++) { | 
 
| 693 | 9 | 16 | while (self->active_threads_cnt != 0) { | 
 
| 700 | 0 | 16 | if (bstree_size(self->fd_map) > 0) { | 
 
| 701 | 0 | 0 | if (!PL_dirty) | 
 
| 707 | 0 | 0 | for (i=0, l=bstree_size(self->fd_map); i | 
 
| 710 | 0 | 0 | if (!res->dequeued) { | 
 
| 711 | 0 | 0 | if (!res->gai_error && res->hostinfo) freeaddrinfo(res->hostinfo); | 
 
|  | 0 | 0 | if (!res->gai_error && res->hostinfo) freeaddrinfo(res->hostinfo); | 
 
| 712 | 0 | 0 | if (res->arg->hints)   free(res->arg->hints); | 
 
| 713 | 0 | 0 | if (res->arg->host)    Safefree(res->arg->host); | 
 
| 714 | 0 | 0 | if (res->arg->service) Safefree(res->arg->service); | 
 
| 727 | 16 | 0 | while (!queue_iterator_end(it)) { | 
 
| 728 | 16 | 0 | if (queue_at(DNS_instances, it) == self) { | 
 
| 736 | 9 | 7 | if (self->in_queue) { | 
 
| 751 | 0 | 0 | char *address = SvPV(sv_address, len); | 
 
| 752 | 0 | 0 | if (len != 16) | 
 
| 760 | 0 | 0 | XPUSHs(sv_2mortal(newSVpvn((char*) addr, sizeof(struct sockaddr_in6)))); | 
 
| 766 | 6 | 0 | char *addr = SvPV(sv_addr, len); | 
 
| 767 | 0 | 6 | if (len != sizeof(struct sockaddr_in6)) | 
 
| 771 | 0 | 6 | XPUSHs(sv_2mortal(newSViv(struct_addr->sin6_port))); | 
 
| 772 | 0 | 6 | XPUSHs(sv_2mortal(newSVpvn((char*)struct_addr->sin6_addr.s6_addr, 16))); |