Condition Coverage

blib/lib/Net/DirectConnect.pm
Criterion Covered Total %
condition 1 491 0.2


and 3 conditions

line !l l&&!r l&&r condition
28 0 0 0 $_[0] < 8 && $_[0] - int($_[0])
114 0 0 0 $$p{'wait'} and not $schedule{$$p{'id'}}{'last'}
116 0 0 0 $schedule{$$p{'id'}}{'last'} + $$p{'every'} < time and !$$p{'runs'} || $schedule{$$p{'id'}}{'runs'} < $$p{'runs'}
0 0 0 $schedule{$$p{'id'}}{'last'} + $$p{'every'} < time and !$$p{'runs'} || $schedule{$$p{'id'}}{'runs'} < $$p{'runs'} and !(ref $$p{'cond'} eq 'CODE') || $$p{'cond'}($p, $schedule{$$p{'id'}}, @_)
0 0 0 $schedule{$$p{'id'}}{'last'} + $$p{'every'} < time and !$$p{'runs'} || $schedule{$$p{'id'}}{'runs'} < $$p{'runs'} and !(ref $$p{'cond'} eq 'CODE') || $$p{'cond'}($p, $schedule{$$p{'id'}}, @_) and ref $schedule{$$p{'id'}}{'func'} eq 'CODE'
152 0 0 0 $_ = $module->can('new') and $_ ne 'Net::DirectConnect'->can('new')
217 0 0 0 not $$self{'protocol'} and $$self{'host'}
281 0 0 0 not $$self{'parent'} || $$self{'no_charset_console'} and $$self{'charset_internal'}
0 0 0 not $$self{'parent'} || $$self{'no_charset_console'} and $$self{'charset_internal'} and $$self{'charset_console'}
341 0 0 0 $$self{'adc'} and length $_[0] == 1
348 0 0 0 $$self{'cmd'} and ref $$self{'cmd'}{$cmd} eq 'CODE'
0 0 0 $$self{'cmd'} and ref $$self{'cmd'}{$dst . $cmd} eq 'CODE'
361 0 0 0 $$self{'min_cmd_delay'} and time - $$self{'last_cmd_time'} < $$self{'min_cmd_delay'}
370 0 0 0 $$self{'adc'} and length $dst == 1
0 0 0 $$self{'adc'} and length $dst == 1 and length $cmd == 3
390 0 0 0 $$self{'cmd'} and $$self{'cmd'}{$cmd}
422 0 0 0 $$self{'handler_int'} and ref $$self{'handler_int'}{$cmd} eq 'CODE'
425 0 0 0 $$self{'handler'} and ref $$self{'handler'}{$cmd} eq 'CODE'
619 0 0 0 $$self{'socket'} and $$self{'socket'}->connected
700 0 0 0 not $$self{'M'} and &$is_local_ip($$self{'myip'})
0 0 0 not $$self{'M'} and &$is_local_ip($$self{'myip'}) and not &$is_local_ip($$self{'hostip'})
882 0 0 0 defined($$self{'recv_addr'} = $client->$recv($$self{'databuf'}, 8192, $$self{'recv_flags'})) && length $$self{'databuf'}
0 0 0 not defined($$self{'recv_addr'} = $client->$recv($$self{'databuf'}, 8192, $$self{'recv_flags'})) && length $$self{'databuf'} and $recv ~~ 'recv'
886 0 0 0 $self->active and not $$self{'incoming'}
915 0 0 0 not $$self{'adc'} and $$self{'recv_buf'} =~ /^[BCDEFHITU][A-Z]{,5} /
919 0 0 0 $$self{'Proto'} eq 'udp' and $$self{'status'} eq 'listening'
926 0 0 0 length $_ and length $$self{'cmd_aft'}
935 0 0 0 length $$self{'recv_buf'} and $$self{'filehandle'}
982 0 0 0 $$self{'sockets'}{$_} and $$self{'sockets'}{$_}{'socket'}
1037 0 0 0 $$self{'filebytes'} and $$self{'filetotal'}
0 0 0 $$self{'filebytes'} and $$self{'filetotal'} and $$self{'filebytes'} < $$self{'filetotal'} - 1
1138 0 0 0 $$self{'clients'}{$_}{'socket'} && length $$self{'clients'}{$_}{'status'}
0 0 0 $$self{'clients'}{$_}{'status'} ne 'listening' and $$self{'clients'}{$_}{'status'} ne 'working'
0 0 0 $$self{'clients'}{$_}{'status'} ne 'listening' and $$self{'clients'}{$_}{'status'} ne 'working' and $$self{'clients'}{$_}{'inactive_timeout'}
0 0 0 $$self{'clients'}{$_}{'status'} ne 'listening' and $$self{'clients'}{$_}{'status'} ne 'working' and $$self{'clients'}{$_}{'inactive_timeout'} and time - $$self{'clients'}{$_}{'activity'} > $$self{'clients'}{$_}{'inactive_timeout'}
1168 0 0 0 $$self{'sockets'}{$_} and %{$$self{'sockets'}{$_};}
1172 0 0 0 $$self{'parent'} and $$self{'parent'}{'parent'}
1196 0 0 0 $$self{'downloading'}{$tth}{'connect_start'} and $$self{'downloading'}{$tth}{'connect_start'} < $time - 60
1207 0 0 0 $$self{'queue_download'} and @{$$self{'queue_download'};}
1348 0 0 0 not exists $$self{'parse'}{$cmd} and exists $$self{'parse'}{$dst . $cmd}
1352 0 0 0 $$self{'nmdc'} and not exists $$self{'parse'}{$cmd}
1439 0 0 0 $$self{'listener'} and not $$self{'broadcast'}
1441 0 0 0 $$self{'adc'} and length $_[0] == 1
1447 0 0 0 $$self{'sendbuf'} and @_
1529 0 0 0 $$self{'M'} eq 'A' and $$self{'myip'}
0 0 0 $$self{'M'} eq 'A' and $$self{'myip'} and not $$self{'passive_get'}
1540 0 0 0 $$self{'M'} eq 'A' && $$self{'myip'} && !$$self{'passive_get'}
1601 0 0 0 $$self{'file_recv_size'} and $$self{'file_recv_from'}
1708 0 0 0 $$self{'select_send'} and $$self{'filehandle_send'}
1778 0 0 0 $$self{'socket'} and $$self{'socket'}->connected
0 0 0 $$self{'socket'} and $$self{'socket'}->connected and $$self{'filehandle_send'}
0 0 0 $$self{'socket'} and $$self{'socket'}->connected and $$self{'filehandle_send'} and $$self{'file_send_left'}
2017 0 0 0 $$self{'every_list'}{$func} + $sec < time and ref $func eq 'CODE'
2112 0 0 0 $peerid and exists $$self{'peers'}{$peerid}
2131 0 0 0 length $_[0] == 39 and $_[0] =~ /^[0-9A-Z]+$/

or 2 conditions

line l !l condition
24 0 0 shift() || (return)
0 0 shift() || (return)
47 0 0 $_[1] || {}
176 0 0 $$self{'recv_flags'} ||= 0
202 0 0 $$self{'protocol'} ||= 'adc'
400 0 0 shift() || (return)
401 0 0 ref $self || (return)
523 0 0 $$self{'parent'}{$_} ||= {}
525 0 0 $$self{'parent'}{$_} ||= []
527 0 0 $global{$_} ||= {}
534 0 0 $$self{$_} //= {%{$$self{'parent'}{$_};}}
595 0 0 $$self{'reconnect_func'} ||= sub { if ($$self{'reconnect_tries'}++ < $$self{'reconnects'}) { $self->log('warn', "reconnecting ($$self{'host'}) [$$self{'reconnect_tries'}/$$self{'reconnects'}] every", $$self{'reconnect_sleep'}); $self->connect; } else { $$self{'status'} = 'disconnected'; } ; }
705 0 0 $$self{'M'} ||= 'A'
1104 0 0 shift() || 1
1186 0 0 our $___work_every ||= sub { my $self = shift(); $self->connect_check; code_run $_, $self foreach (values %{{} unless $$self{'periodic'};}); foreach $_ (keys %{$$self{'clients'};}) { if (not $$self{'clients'}{$_}{'socket'} && length $$self{'clients'}{$_}{'status'} or $$self{'clients'}{$_}{'status'} eq 'destroy' or $$self{'clients'}{$_}{'status'} ne 'listening' and $$self{'clients'}{$_}{'status'} ne 'working' and $$self{'clients'}{$_}{'inactive_timeout'} and time - $$self{'clients'}{$_}{'activity'} > $$self{'clients'}{$_}{'inactive_timeout'}) { $self->log('dev', "del client[$$self{'clients'}{$_}{'number'}][$_] socket=[$$self{'clients'}{$_}{'socket'}] status=[$$self{'clients'}{$_}{'status'}] listener=[$$self{'listener'}] last active=", int time - $$self{'clients'}{$_}{'activity'}); delete $$self{'clients'}{$_}; next; } ; } ; foreach $_ (keys %{$$self{'sockets'};}) { next if $$self{'sockets'}{$_} and %{$$self{'sockets'}{$_};}; delete $$self{'sockets'}{$_}; } ; unless ($$self{'parent'} and $$self{'parent'}{'parent'}) { code_run $$self{$_}, $self foreach ('worker'); } ; foreach $_ (grep {$$self{'clients'}{$_} ne $self;} keys %{$$self{'clients'};}) { $$self{'clients'}{$_}->work if $$self{'clients'}{$_}; } ; }
1221 0 0 $$self{'want_download'}{$tth} || {}
1252 0 0 $$from{'size'} || $$from{'SI'} || 0
1272 0 0 our $___work_downloader ||= sub { my $self = shift(); return unless $self->active; return if $$self{'status'} eq 'listening'; my $time = time; foreach my $tth (keys %{$$self{'downloading'};}) { if ($$self{'downloading'}{$tth}{'connect_start'} and $$self{'downloading'}{$tth}{'connect_start'} < $time - 60) { $$self{'want_download'}{$tth} = $$self{'downloading'}{$tth}; delete $$self{'downloading'}{$tth}; } ; } ; foreach my $tth (keys %{$$self{'want_download'};}) { delete $$self{'want_download'}{$tth}{'connect_start'}; } ; if ($$self{'queue_download'} and @{$$self{'queue_download'};}) { my $file = shift @{$$self{'queue_download'};}; $self->search($file); } ; foreach my $tth (grep {keys %{$$self{'want_download'}{$_};};} keys %{$$self{'want_download'};}) { my $wdls = $$self{'want_download'}{$tth} || {}; local(@_) = (sort {($$wdls{$b}{'slotsfree'} || $$wdls{$b}{'SL'}) <=> ($$wdls{$a}{'slotsfree'} || $$wdls{$a}{'SL'}) unless $$wdls{$a}{'tries'} <=> $$wdls{$b}{'tries'};} keys %$wdls); if (my($fromk) = $_[0]) { my $from = $$wdls{$fromk}; my $filename; foreach my $file (keys %{$$self{'want_download_filename'}{$tth};}) { my $partial = $file; $partial = $$self{'partial_prefix'} . $partial . $$self{'partial_ext'}; $partial = &Encode::encode($$self{'charset_fs'}, $file, &Encode::FB_WARN()) if $$self{'charset_fs'}; if (-s $partial) { $self->log('dev', 'already downloading: ', $file, -s $partial); $filename = $file; last; } ; } ; $filename //= (sort {$$self{'want_download_filename'}{$tth}{$a} <=> $$self{'want_download_filename'}{$tth}{$b};} keys %{$$self{'want_download_filename'}{$tth};})[0]; $filename //= $$from{'FN'}; $filename =~ s(^.*[/\\])[]g; my $size = $$from{'size'} || $$from{'SI'} || 0; ++$$self{'want_download'}{$tth}{$fromk}{'tries'}; $self->get($$from{'nick'} || $$from{'CID'} || $$from{'NI'}, undef, $filename, undef, undef, $size, $tth); $$self{'downloading'}{$tth} = $$self{'want_download'}{$tth}; $$self{'downloading'}{$tth}{'connect_start'} = $time; delete $$self{'want_download'}{$tth}; last; } ; } ; }
1280 0 0 $$self{'dev_auto_dump_first'} || 20
0 0 $$self{'dev_auto_dump_every'} || 100
0 0 our $dump_sub__ ||= sub { my $self = shift(); $self->dumper; }
1419 0 0 $$self{'send_buffer_raw'} ||= []
1511 0 0 $as || $file || ''
1520 0 0 $$self{'peers'}{$cid} || $$self{'peers'}{$sid} || $$self{'peers'}{$nick} || {}
1644 0 0 time - $$self{'__stat_recv_lasttime'} || 1
1656 0 0 $$self{'__stat_recv'} ||= sub { my $self = shift(); my $recv = shift(); $self->log('dev', 'recv bytes', "recv=[$recv] now [", $$self{'filebytes'}, "] of [$$self{'filetotal'}], now", 's=', int(($$self{'filebytes'} - $$self{'__stat_recv_lastmark'}) / (time - $$self{'__stat_recv_lasttime'} || 1)), "status=[$$self{'status'}]"), $$self{'__stat_recv_lastmark'} = $$self{'filebytes'}; $$self{'__stat_recv_lasttime'} = time; }
1661 0 0 time - $$self{'file_start_time'} || 1
1740 0 0 $start //= 0
1752 0 0 $start || 0
1822 0 0 time - $$self{'__stat_lasttime'} || 1
1836 0 0 $$self{'__stat_'} ||= sub { my $self = shift(); my $sent = shift(); my $read = shift(); $self->log('dev', 'sent bytes', "sent=[$sent] of buf [", length $$self{'file_send_buf'}, "] by [${read}:$$self{'file_send_by'}] left $$self{'file_send_left'}, now", $$self{'file_send_offset'}, 'of', $$self{'file_send_total'}, 's=', int(($$self{'file_send_offset'} - $$self{'__stat_lastmark'}) / (time - $$self{'__stat_lasttime'} || 1)), "status=[$$self{'status'}]"), $$self{'__stat_lastmark'} = $$self{'file_send_offset'}; $$self{'__stat_lasttime'} = time; }
1911 0 0 $$self{'queue_download'} ||= []
1913 0 0 $$self{'want_download'}{$file} ||= {}
2164 0 0 $$self{'nick_random'} || 100

or 3 conditions

line l !l&&r !l&&!r condition
34 0 0 0 shift() // $_
109 0 0 0 $$p{'every'} ||= $every
110 0 0 0 $$p{'id'} ||= join(';', caller)
113 0 0 0 not $schedule{$$p{'id'}}{'func'} or $$p{'update'}
116 0 0 0 !$$p{'runs'} || $schedule{$$p{'id'}}{'runs'} < $$p{'runs'}
0 0 0 !(ref $$p{'cond'} eq 'CODE') || $$p{'cond'}($p, $schedule{$$p{'id'}}, @_)
134 0 0 1 $INC{$path} || eval 'use ' . $module . ' qw(' . join(' ', @_) . ');1;' && $INC{$path}
171 0 0 0 $$self{'number'} ||= ++$global{'total'}
198 0 0 0 $$self{'host'} ~~ qr"^(?:\w+://)?broadcast" or $$self{'host'} =~ /^(?:255\.|\[?ff)/i
226 0 0 0 not $$self{'protocol'} or $$self{'protocol'} eq 'dchub'
275 0 0 0 $$self{'charset_chat'} ||= $$self{'charset_protocol'}
281 0 0 0 $$self{'parent'} || $$self{'no_charset_console'}
305 0 0 0 $$self{'incomingclass'} ||= $$self{'parent'}{'incomingclass'}
522 0 0 0 $$self{'wait_connect_tries'} //= $$self{'Timeout'}
523 0 0 0 $$self{$_} //= ($$self{'parent'}{$_} ||= {})
525 0 0 0 $$self{$_} //= ($$self{'parent'}{$_} ||= [])
527 0 0 0 $$self{'parent'}{$_} ||= ($global{$_} ||= {})
0 0 0 $$self{$_} //= ($$self{'parent'}{$_} ||= ($global{$_} ||= {}))
528 0 0 0 $$self{'parent'}{$_} ||= $global{$_}
0 0 0 $$self{$_} //= ($$self{'parent'}{$_} ||= $global{$_})
530 0 0 0 $$self{$_} //= $$self{'parent'}{$_}
535 0 0 0 $$self{$_} //= $_{$_}
536 0 0 0 $$self{'partial_prefix'} //= $$self{'download_to'} . 'Incomplete/'
545 0 0 0 $$self{'myport_base'} or $$self{'myport_random'}
549 0 0 0 $$self{'myport'} ||= $$self{'myport_base'} + $$self{'myport_inc'}++
550 0 0 0 $$self{'myport'} ||= $$self{'myport_base'} + int(rand $$self{'myport_random'})
557 0 0 0 $global{$_} ||= 'IO::Select'->new
0 0 0 $$self{'parent'}{$_} ||= ($global{$_} ||= 'IO::Select'->new)
0 0 0 $$self{$_} ||= ($$self{'parent'}{$_} ||= ($global{$_} ||= 'IO::Select'->new))
570 0 0 0 $$self{'Proto'} eq 'udp' or $$self{'incoming'}
0 0 0 $$self{'Proto'} eq 'udp' or $$self{'incoming'} or $$self{'listener'}
0 0 0 $$self{'Proto'} eq 'udp' or $$self{'incoming'} or $$self{'listener'} or $$self{'socket'}
0 0 0 $$self{'Proto'} eq 'udp' or $$self{'incoming'} or $$self{'listener'} or $$self{'socket'} or not $self->active
602 0 0 0 $_[0] or $$self{'host'} =~ /:/
619 0 0 0 $$self{'socket'} and $$self{'socket'}->connected or grep {$$self{'status'} eq $_;} 'destroy'
645 0 0 0 $$self{'socket'} ||= $$self{'socket_class'}->new('PeerAddr', $$self{'host'}, $$self{'port'} ? ('PeerPort', $$self{'port'}) : (), $$self{'Proto'} ? ('Proto', $$self{'Proto'}) : (), 'Blocking', 0, %{$$self{'socket_options'};}, %{$$self{'socket_options_connect'};})
694 0 0 0 my $localmask ||= join('|', map({ref $_ eq 'ARRAY' ? @$_ : $_;} grep({$_;} $$self{'local_mask_rfc'}, $$self{'local_mask'})))
748 0 0 0 $$self{'socket'} ||= $$self{'socket_class'}->new(@_)
866 0 0 0 $$_{'hostip'} || $$_{'host'}
867 0 0 0 $$self{'clients'}{$name} ||= $_
944 0 0 0 shift() || $$self{'select_timeout'}
1002 0 0 0 not ref $$self{'sockets'}{$_} or ref $$self{'sockets'}{$_} eq 'HASH'
1051 0 0 0 $_[0] || $$self{'wait_connect_tries'}
1062 0 0 0 shift() || $$self{'wait_finish'}
1084 0 0 0 shift() || $$self{'wait_clients'}
1088 0 0 0 not $$self{'clients_max'} or $$self{'clients_max'} > (@_ = $self->clients_my)
1109 0 0 0 $self->select || $self->select(1, 1)
1138 0 0 0 not $$self{'clients'}{$_}{'socket'} && length $$self{'clients'}{$_}{'status'} or $$self{'clients'}{$_}{'status'} eq 'destroy'
0 0 0 not $$self{'clients'}{$_}{'socket'} && length $$self{'clients'}{$_}{'status'} or $$self{'clients'}{$_}{'status'} eq 'destroy' or $$self{'clients'}{$_}{'status'} ne 'listening' and $$self{'clients'}{$_}{'status'} ne 'working' and $$self{'clients'}{$_}{'inactive_timeout'} and time - $$self{'clients'}{$_}{'activity'} > $$self{'clients'}{$_}{'inactive_timeout'}
1222 0 0 0 $$wdls{$b}{'slotsfree'} || $$wdls{$b}{'SL'}
0 0 0 $$wdls{$a}{'slotsfree'} || $$wdls{$a}{'SL'}
1246 0 0 0 $filename //= (sort {$$self{'want_download_filename'}{$tth}{$a} <=> $$self{'want_download_filename'}{$tth}{$b};} keys %{$$self{'want_download_filename'}{$tth};})[0]
1248 0 0 0 $filename //= $$from{'FN'}
1257 0 0 0 $$from{'nick'} || $$from{'CID'} || $$from{'NI'}
1287 0 0 0 $self->select(undef, 1) || $self->select($$self{'work_sleep'}) || $self->select(undef, 1)
1295 0 0 0 $_[0] || $$self{'dev_auto_dump_file'} || $0 . ($$self{'dev_auto_dump_timed'} ? '.' . time : ()) . '.dump'
1325 0 0 0 $dst eq 'B' or $dst eq 'F'
0 0 0 $dst eq 'B' or $dst eq 'F' or $dst eq 'U'
0 0 0 $dst eq 'B' or $dst eq 'F' or $dst eq 'U' or $$self{'broadcast'}
0 0 0 $dst eq 'D' or $dst eq 'E'
1354 0 0 0 $cmd eq 'chatline' or $cmd eq 'welcome'
0 0 0 $cmd eq 'chatline' or $cmd eq 'welcome' or $cmd eq 'To'
1447 0 0 0 $$self{'sendbuf'} and @_ or not @{[] unless $$self{'send_buffer'};}
1492 0 0 0 $cid ||= $$self{'peers'}{$sid}{'INF'}{'ID'}
1493 0 0 0 $sid ||= $$self{'peers'}{$cid}{'SID'}
1494 0 0 0 $sid ||= $cid
1495 0 0 0 $file //= 'TTH/' . $tth
1496 0 0 0 $as || $file
1511 0 0 0 $$self{'peers'}{$cid}{'INF'}{'ID'} or $$self{'peers'}{$sid}{'INF'}{'ID'}
0 0 0 $$self{'peers'}{$cid}{'INF'}{'ID'} or $$self{'peers'}{$sid}{'INF'}{'ID'} or $nick
1548 0 0 0 $$self{'peerid'} || $$self{'peernick'}
1565 0 0 0 $$self{'peers'}{$peerid}{'SUP'}{'BZIP'} or $$self{'NickList'}{$peerid}{'XmlBZList'}
1583 0 0 0 $$self{'fileas'} || $$self{'filename'}
1601 0 0 0 $$self{'file_recv_to'} ||= $$self{'file_recv_size'} - $$self{'file_recv_from'}
1629 0 0 0 $$self{'file_start_time'} ||= time
1695 0 0 0 $$self{'parent'} || $self
1700 0 0 0 $$self{'filebytes'} <= $$self{'filetotal'} or $$self{'file_recv_size'}
1743 0 0 0 not -e $file or -d $file
1758 0 0 0 $as || $name
1760 0 0 0 $as || $name
1923 0 0 0 $$self{'host'} ||= $$self{'hostip'}
1944 0 0 0 $recv ||= $$self{'recv_addr'}
1956 0 0 0 $$self{'myport'} ||= $$self{'socket'}->sockport
1958 0 0 0 $$self{'myip'} ||= $$self{'socket'}->sockhost
2040 0 0 0 $dst eq 'C' || !length($$self{'INF'}{'SID'})
2163 0 0 0 $$self{'nick_base'} ||= $$self{'Nick'}