Branch Coverage

blib/lib/Net/Clacks/Server.pm
Criterion Covered Total %
branch 0 366 0.0


line true false branch
87 0 0 if (defined $ENV{'CLACKS_SIMULATED_TIME_OFFSET'})
104 0 0 if (defined $ENV{'PC_CONFIG_PATHS'}) { }
115 0 0 if ($path ne "" and not $path =~ m[/$]u)
119 0 0 unless -f $fullfname
125 0 0 unless $varname =~ /^PC\_/u
134 0 0 if (not defined $filedata or $filedata eq "")
144 0 0 if (defined $config->{'hosts'}{$hname})
152 0 0 unless (defined $self->{'config'}{'throttle'}{'maxsleep'})
155 0 0 unless (defined $self->{'config'}{'throttle'}{'step'})
161 0 0 unless (defined $self->{'config'}{'ssl'} and defined $self->{'config'}{'ssl'}{'cert'} and defined $self->{'config'}{'ssl'}{'key'})
166 0 0 unless (-f $self->{'config'}{'ssl'}{'cert'})
169 0 0 unless (-f $self->{'config'}{'ssl'}{'key'})
173 0 0 unless (defined $self->{'config'}{'username'})
176 0 0 unless (defined $self->{'config'}{'password'})
181 0 0 if (defined $self->{'config'}{'persistancefile'}) { }
187 0 0 if (not defined $self->{'config'}{'persistanceinterval'}) { }
193 0 0 unless (defined $self->{'config'}{'interclacksreconnecttimeout'})
197 0 0 unless (defined $self->{'config'}{'authtimeout'})
201 0 0 unless (defined $self->{'config'}{'deletedcachetime'})
204 0 0 unless (defined $self->{'config'}{'stalecachetime'})
210 0 0 if (defined $config->{'ip'})
215 0 0 unless my $tcp = "IO::Socket::IP"->new("LocalHost", $ip, "LocalPort", $config->{'port'}, "Listen", 1, "Blocking", 0, "ReuseAddr", 1, "Proto", "tcp")
226 0 0 if (defined $config->{'socket'} or defined $self->{'config'}{'master'}{'socket'})
232 0 0 unless ($udsloaded)
255 0 0 if (defined $config->{'socket'})
257 0 0 if (-S $socket)
261 0 0 unless my $tcp = "IO::Socket::UNIX"->new("Type", 1, "Local", $socket, "Listen", 1)
272 0 0 if (defined $config->{'socketchmod'} and $config->{'socketchmod'} ne "")
296 0 0 if (open my $ifh, '<', $fname) { }
308 0 0 if (not defined $endline and $accesstimeline eq 'ENDBYTES') { }
316 0 0 if (not defined $line && defined $timestampline or $endline ne "ENDBYTES")
323 0 0 if ($line ne "")
329 0 0 unless ($loadok)
342 0 0 if ($timestampline ne "")
349 0 0 if (not $loadok) { }
360 0 0 if ($needupgrade) { }
0 0 elsif ($accesstimeline ne '') { }
372 0 0 if (not $loadok) { }
417 0 0 if ($self->{'persistance'})
421 0 0 if (-f $self->{'config'}{'persistancefile'})
424 0 0 if (defined $cc and ref $cc eq "HASH")
433 0 0 if (not $loadok and -f $previousfname)
436 0 0 if (defined $cc and ref $cc eq "HASH")
444 0 0 if (not $loadok and -f $tempfname)
447 0 0 if (defined $cc and ref $cc eq "HASH")
456 0 0 if (not $loadok) { }
468 0 0 if ($shutdowntime and $shutdowntime < &Net::Clacks::Server::time())
474 0 0 if ($savecache and $now > $lastsavecache + $self->{'persistanceinterval'})
481 0 0 if (defined $self->{'config'}{'master'}{'socket'} or defined $self->{'config'}{'master'}{'ip'})
483 0 0 if (defined $self->{'config'}{'master'}{'socket'}) { }
488 0 0 if (not defined $clients{$mcid} and $nextinterclackscheck < $now)
494 0 0 if (defined $self->{'config'}{'master'}{'socket'}) { }
507 0 0 if (not defined $msocket) { }
512 0 0 if (ref $msocket ne "IO::Socket::UNIX")
518 0 0 unless ($encrypted)
552 0 0 if (defined $self->{'config'}{'master'}{'ip'})
567 0 0 if (defined $clientsocket)
570 0 0 if (ref $tcpsocket eq 'IO::Socket::UNIX') { }
579 0 0 if ($clients{$debugcid}{'mirror'})
584 0 0 if (ref $clientsocket ne "IO::Socket::UNIX")
605 0 0 unless ($encrypted)
656 0 0 unless ($clients{$cid}{'socket'}->connected)
660 0 0 if (not $clients{$cid}{'interclacks'}) { }
661 0 0 if ($clients{$cid}{'lastping'} > 0 and $clients{$cid}{'lastping'} < $pingtime)
667 0 0 if ($clients{$cid}{'lastping'} < $interclackspingtime)
674 0 0 if ($clients{$cid}{'interclacks'} and $clients{$cid}{'lastinterclacksping'} < $interclackspinginterval)
679 0 0 if (not $clients{$cid}{'authok'} and $clients{$cid}{'authtimeout'} < $now)
688 0 0 if (defined $clients{$cid})
691 0 0 if ($clients{$debugcid}{'mirror'})
696 0 0 if ($clients{$cid}{'interclacksclient'} and $interclackslock)
708 0 0 unless (scalar keys %clients)
717 0 0 if (length $clients{$cid}{'buffer'} > 0)
724 0 0 if ($hasoutbufferwork)
741 0 0 unless ($readok)
745 0 0 if (defined $rawbuffer and length $rawbuffer)
749 0 0 unless ($readchunksleft)
760 0 0 if ($totalread) { }
765 0 0 if ($clients{$cid}{'failcount'} > 5)
778 0 0 if ($buf eq "\r") { }
0 0 elsif ($buf eq "\n") { }
781 0 0 if $clients{$cid}{'buffer'} eq ""
794 0 0 if ($interclackslock and not $clients{$cid}{'interclacksclient'})
809 0 0 if $clients{$cid}{'inmessages'}[0]{'releasetime'} > $now
814 0 0 if ($inmsg =~ /^CLACKS\ (.+)/u)
825 0 0 if ($inmsg =~ /^OVERHEAD\ (.+?)\ (.+)/u)
832 0 0 if (contains($key, \@flagparts)) { }
841 0 0 if ($parsedflags{'auth_token'})
842 0 0 if ($value eq $self->{'authtoken'}) { }
857 0 0 unless ($clients{$cid}{'authok'})
861 0 0 if ($parsedflags{'timestamp'})
868 0 0 if ($parsedflags{'lock_for_sync'} and $clients{$cid}{'interclacksclient'})
869 0 0 if ($value) { }
882 0 0 if defined $self->{'clackscache'}{$ckey}
890 0 0 if ($parsedflags{'close_all_connections'} and $value)
892 0 0 if ($clients{$closecid}{'interclacks'} and $parsedflags{'forward_message'})
901 0 0 if ($parsedflags{'shutdown_service'})
903 0 0 if ($value > 0)
908 0 0 if ($parsedflags{'discard_message'})
911 0 0 if ($parsedflags{'no_logging'})
915 0 0 if ($parsedflags{'error_message'})
919 0 0 if ($parsedflags{'set_interclacks_mode'})
923 0 0 if ($value) { }
940 0 0 if defined $self->{'clackscache'}{$ckey}
956 0 0 if $key eq "Z"
957 0 0 if ($newflags{$overheadflags{$key}})
961 0 0 if ($newflagstring eq "")
965 0 0 if ($parsedflags{'forward_message'})
967 0 0 if $cid eq $overheadcid and not $parsedflags{'return_to_sender'}
975 0 0 unless ($clients{$cid}{'authok'})
979 0 0 unless ($nodebug)
990 0 0 if ($discardafterlogging)
995 0 0 if ($inmsg =~ /^OVERHEAD\ /u) { }
0 0 elsif ($inmsg =~ /^LISTEN\ (.*)/u) { }
0 0 elsif ($inmsg =~ /^UNLISTEN\ (.*)/u) { }
0 0 elsif ($inmsg =~ /^MONITOR/u) { }
0 0 elsif ($inmsg =~ /^UNMONITOR/u) { }
0 0 elsif ($inmsg =~ /^QUIT/u) { }
0 0 elsif ($inmsg =~ /^TIMEOUT/u and $clients{$cid}{'interclacks'}) { }
0 0 elsif ($inmsg =~ /^PING/u) { }
0 0 elsif ($inmsg =~ /^NOPING/u) { }
0 0 elsif ($inmsg =~ /^NOTIFY\ (.*)/u) { }
0 0 elsif ($inmsg =~ /^SET\ (.+?)\=(.*)/u) { }
0 0 elsif ($inmsg =~ /^KEYSYNC\ (.+?)\ (.+?)\ (.+?)\ (.+?)\=(.*)/u) { }
0 0 elsif ($inmsg =~ /^STORE\ (.+?)\=(.*)/u) { }
0 0 elsif ($inmsg =~ /^SETANDSTORE\ (.+?)\=(.*)/u) { }
0 0 elsif ($inmsg =~ /^RETRIEVE\ (.+)/u) { }
0 0 elsif ($inmsg =~ /^REMOVE\ (.+)/u) { }
0 0 elsif ($inmsg =~ /^INCREMENT\ (.+)/u) { }
0 0 elsif ($inmsg =~ /^DECREMENT\ (.+)/u) { }
0 0 elsif ($inmsg =~ /^KEYLIST/u) { }
0 0 elsif ($inmsg =~ /^CLEARCACHE/u) { }
0 0 elsif ($inmsg =~ /^CLIENTLIST/u) { }
0 0 elsif ($inmsg =~ /^CLIENTDISCONNECT\ (.+)/u) { }
0 0 elsif ($inmsg =~ /^FLUSH\ (.+)/u) { }
1045 0 0 if ($atimestamp)
1049 0 0 unless (defined $self->{'clackscachetime'}{$ckey})
1052 0 0 if (not defined $self->{'clackscachetime'}{$ckey} or $ctimestamp > $self->{'clackscachetime'}{$ckey})
1054 0 0 if ($cmode eq 'U') { }
1060 0 0 if (defined $self->{'clackscache'}{$ckey})
1063 0 0 if (defined $self->{'clackscacheaccesstime'}{$ckey})
1091 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1101 0 0 if (defined $self->{'clackscache'}{$ckey})
1105 0 0 if (defined $self->{'clackscacheaccesstime'}{$ckey})
1112 0 0 if ($ckey =~ /(.+)\=(.+)/u)
1116 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1127 0 0 if ($ckey =~ /(.+)\=(.+)/u)
1131 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1172 0 0 if (defined $clients{$lmccid})
1189 0 0 if ($sendinterclacks)
1191 0 0 if ($cid eq $interclackscid or not $clients{$interclackscid}{'interclacks'})
1205 0 0 if $self->{'clackscachetime'}{$key} > $stillvalidtime
1206 0 0 if (defined $self->{'clackscache'}{$key})
1216 0 0 if $self->{'clackscacheaccesstime'}{$key} > $stillvalidtime
1218 0 0 if (defined $self->{'clackscache'})
1221 0 0 if (defined $self->{'clackscachetime'})
1240 0 0 if ($line->{'type'} eq "DEBUG" and $clients{$cid}{'mirror'})
1244 0 0 if ($cid eq $line->{'sender'})
1248 0 0 if ($line->{'type'} ne "DEBUG" and defined $clients{$cid}{'listening'}{$line->{'name'}})
1250 0 0 if ($line->{'type'} eq 'NOTIFY') { }
0 0 elsif ($line->{'type'} eq 'SET') { }
0 0 elsif ($line->{'type'} eq 'SETANDSTORE') { }
1257 0 0 if ($clients{$cid}{'interclacks'}) { }
1271 0 0 if $clients{$cid}{'outmessages'}[0]{'releasetime'} > $now
1274 0 0 if ($outmsg->{'message'} eq 'EXIT') { }
1292 0 0 if (length $clients{$cid}{'outbuffer'}) { }
0 0 elsif ($clients{$cid}{'lastmessage'} + 60 < $now) { }
1300 0 0 unless length $clients{$cid}{'outbuffer'}
1308 0 0 if ($Net::Clacks::Server::EVAL_ERROR)
1313 0 0 if (not $clients{$cid}{'socket'}->opened or $clients{$cid}{'socket'}->error or $Net::Clacks::Server::ERRNO ne "" and not $Net::Clacks::Server::ERRNO{'EWOULDBLOCK'})
1319 0 0 if (defined $written and $written)
1320 0 0 if (length $clients{$cid}{'outbuffer'} == $written) { }
1328 0 0 if ($workCount) { }
0 0 elsif ($self->{'usleep'} < $self->{'config'}{'throttle'}{'maxsleep'}) { }
1333 0 0 if ($self->{'usleep'})
1359 0 0 unless ($self->{'persistance'})
1373 0 0 if ($savecache == 1)
1378 0 0 if (open my $ofh, ">", $tempfname)
1387 0 0 if ($savecache == 2)
1398 0 0 unless defined $val
1402 0 0 unless defined $val
1411 0 0 unless length $buffer
1419 0 0 if ($Net::Clacks::Server::EVAL_ERROR or not $ok)
1441 0 0 unless open my $fh, "<", $fname