Branch Coverage

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


line true false branch
88 0 0 if (defined $ENV{'CLACKS_SIMULATED_TIME_OFFSET'})
103 0 0 if (defined $ENV{'PC_CONFIG_PATHS'}) { }
114 0 0 if ($path ne "" and not $path =~ m[/$]u)
118 0 0 unless -f $fullfname
124 0 0 unless $varname =~ /^PC\_/u
133 0 0 if (not defined $filedata or $filedata eq "")
143 0 0 if (defined $config->{'hosts'}{$hname})
151 0 0 unless (defined $self->{'config'}{'throttle'}{'maxsleep'})
154 0 0 unless (defined $self->{'config'}{'throttle'}{'step'})
160 0 0 unless (defined $self->{'config'}{'ssl'} and defined $self->{'config'}{'ssl'}{'cert'} and defined $self->{'config'}{'ssl'}{'key'})
165 0 0 unless (-f $self->{'config'}{'ssl'}{'cert'})
168 0 0 unless (-f $self->{'config'}{'ssl'}{'key'})
172 0 0 unless (defined $self->{'config'}{'username'})
175 0 0 unless (defined $self->{'config'}{'password'})
180 0 0 if (defined $self->{'config'}{'persistancefile'}) { }
186 0 0 if (not defined $self->{'config'}{'persistanceinterval'}) { }
192 0 0 unless (defined $self->{'config'}{'interclacksreconnecttimeout'})
196 0 0 unless (defined $self->{'config'}{'authtimeout'})
200 0 0 unless (defined $self->{'config'}{'deletedcachetime'})
203 0 0 unless (defined $self->{'config'}{'stalecachetime'})
209 0 0 if (defined $config->{'ip'})
210 0 0 unless (defined $config->{'port'})
217 0 0 unless my $tcp = "IO::Socket::IP"->new("LocalHost", $ip, "LocalPort", $config->{'port'}, "Listen", 1, "Blocking", 0, "ReuseAddr", 1, "Proto", "tcp")
228 0 0 if (defined $config->{'socket'} or defined $self->{'config'}{'master'}{'socket'})
234 0 0 unless ($udsloaded)
257 0 0 if (defined $config->{'socket'})
259 0 0 if (-S $socket)
263 0 0 unless my $tcp = "IO::Socket::UNIX"->new("Type", 1, "Local", $socket, "Listen", 1)
274 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) { }
415 0 0 if ($self->{'persistance'})
419 0 0 if (-f $self->{'config'}{'persistancefile'})
422 0 0 if (defined $cc and ref $cc eq "HASH")
431 0 0 if (not $loadok and -f $previousfname)
434 0 0 if (defined $cc and ref $cc eq "HASH")
442 0 0 if (not $loadok and -f $tempfname)
445 0 0 if (defined $cc and ref $cc eq "HASH")
454 0 0 if (not $loadok) { }
466 0 0 if ($shutdowntime and $shutdowntime < &Net::Clacks::Server::time())
472 0 0 if ($savecache and $now > $lastsavecache + $self->{'persistanceinterval'})
479 0 0 if (defined $self->{'config'}{'master'}{'socket'} or defined $self->{'config'}{'master'}{'ip'})
481 0 0 if (defined $self->{'config'}{'master'}{'socket'}) { }
486 0 0 if (not defined $clients{$mcid} and $nextinterclackscheck < $now)
492 0 0 if (defined $self->{'config'}{'master'}{'socket'}) { }
505 0 0 if (not defined $msocket) { }
510 0 0 if (ref $msocket ne "IO::Socket::UNIX")
516 0 0 unless ($encrypted)
550 0 0 if (defined $self->{'config'}{'master'}{'ip'})
565 0 0 if (defined $clientsocket)
568 0 0 if (ref $tcpsocket eq 'IO::Socket::UNIX') { }
577 0 0 if ($clients{$debugcid}{'mirror'})
582 0 0 if (ref $clientsocket ne "IO::Socket::UNIX")
603 0 0 unless ($encrypted)
654 0 0 unless ($clients{$cid}{'socket'}->connected)
658 0 0 if (not $clients{$cid}{'interclacks'}) { }
659 0 0 if ($clients{$cid}{'lastping'} > 0 and $clients{$cid}{'lastping'} < $pingtime)
665 0 0 if ($clients{$cid}{'lastping'} < $interclackspingtime)
672 0 0 if ($clients{$cid}{'interclacks'} and $clients{$cid}{'lastinterclacksping'} < $interclackspinginterval)
677 0 0 if (not $clients{$cid}{'authok'} and $clients{$cid}{'authtimeout'} < $now)
686 0 0 if (defined $clients{$cid})
689 0 0 if ($clients{$debugcid}{'mirror'})
694 0 0 if ($clients{$cid}{'interclacksclient'} and $interclackslock)
706 0 0 unless (scalar keys %clients)
715 0 0 if (length $clients{$cid}{'buffer'} > 0)
722 0 0 if ($hasoutbufferwork)
739 0 0 unless ($readok)
743 0 0 if (defined $rawbuffer and length $rawbuffer)
747 0 0 unless ($readchunksleft)
758 0 0 if ($totalread) { }
763 0 0 if ($clients{$cid}{'failcount'} > 5)
776 0 0 if ($buf eq "\r") { }
0 0 elsif ($buf eq "\n") { }
779 0 0 if $clients{$cid}{'buffer'} eq ""
792 0 0 if ($interclackslock and not $clients{$cid}{'interclacksclient'})
807 0 0 if $clients{$cid}{'inmessages'}[0]{'releasetime'} > $now
812 0 0 if ($inmsg =~ /^CLACKS\ (.+)/u)
823 0 0 if ($inmsg =~ /^OVERHEAD\ (.+?)\ (.+)/u)
830 0 0 if (contains($key, \@flagparts)) { }
839 0 0 if ($parsedflags{'auth_token'})
840 0 0 if ($value eq $self->{'authtoken'}) { }
855 0 0 unless ($clients{$cid}{'authok'})
859 0 0 if ($parsedflags{'timestamp'})
866 0 0 if ($parsedflags{'lock_for_sync'} and $clients{$cid}{'interclacksclient'})
867 0 0 if ($value) { }
880 0 0 if defined $self->{'clackscache'}{$ckey}
888 0 0 if ($parsedflags{'close_all_connections'} and $value)
890 0 0 if ($clients{$closecid}{'interclacks'} and $parsedflags{'forward_message'})
899 0 0 if ($parsedflags{'shutdown_service'})
901 0 0 if ($value > 0)
906 0 0 if ($parsedflags{'discard_message'})
909 0 0 if ($parsedflags{'no_logging'})
913 0 0 if ($parsedflags{'error_message'})
917 0 0 if ($parsedflags{'set_interclacks_mode'})
921 0 0 if ($value) { }
938 0 0 if defined $self->{'clackscache'}{$ckey}
954 0 0 if $key eq "Z"
955 0 0 if ($newflags{$overheadflags{$key}})
959 0 0 if ($newflagstring eq "")
963 0 0 if ($parsedflags{'forward_message'})
965 0 0 if $cid eq $overheadcid and not $parsedflags{'return_to_sender'}
973 0 0 unless ($clients{$cid}{'authok'})
977 0 0 unless ($nodebug)
988 0 0 if ($discardafterlogging)
993 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) { }
1043 0 0 if ($atimestamp)
1047 0 0 unless (defined $self->{'clackscachetime'}{$ckey})
1050 0 0 if (not defined $self->{'clackscachetime'}{$ckey} or $ctimestamp > $self->{'clackscachetime'}{$ckey})
1052 0 0 if ($cmode eq 'U') { }
1058 0 0 if (defined $self->{'clackscache'}{$ckey})
1061 0 0 if (defined $self->{'clackscacheaccesstime'}{$ckey})
1089 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1099 0 0 if (defined $self->{'clackscache'}{$ckey})
1103 0 0 if (defined $self->{'clackscacheaccesstime'}{$ckey})
1110 0 0 if ($ckey =~ /(.+)\=(.+)/u)
1114 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1125 0 0 if ($ckey =~ /(.+)\=(.+)/u)
1129 0 0 if (defined $self->{'clackscache'}{$ckey}) { }
1170 0 0 if (defined $clients{$lmccid})
1187 0 0 if ($sendinterclacks)
1189 0 0 if ($cid eq $interclackscid or not $clients{$interclackscid}{'interclacks'})
1203 0 0 if $self->{'clackscachetime'}{$key} > $stillvalidtime
1204 0 0 if (defined $self->{'clackscache'}{$key})
1214 0 0 if $self->{'clackscacheaccesstime'}{$key} > $stillvalidtime
1216 0 0 if (defined $self->{'clackscache'})
1219 0 0 if (defined $self->{'clackscachetime'})
1238 0 0 if ($line->{'type'} eq "DEBUG" and $clients{$cid}{'mirror'})
1242 0 0 if ($cid eq $line->{'sender'})
1246 0 0 if ($line->{'type'} ne "DEBUG" and defined $clients{$cid}{'listening'}{$line->{'name'}})
1248 0 0 if ($line->{'type'} eq 'NOTIFY') { }
0 0 elsif ($line->{'type'} eq 'SET') { }
0 0 elsif ($line->{'type'} eq 'SETANDSTORE') { }
1255 0 0 if ($clients{$cid}{'interclacks'}) { }
1269 0 0 if $clients{$cid}{'outmessages'}[0]{'releasetime'} > $now
1272 0 0 if ($outmsg->{'message'} eq 'EXIT') { }
1290 0 0 if (length $clients{$cid}{'outbuffer'}) { }
0 0 elsif ($clients{$cid}{'lastmessage'} + 60 < $now) { }
1298 0 0 unless length $clients{$cid}{'outbuffer'}
1306 0 0 if ($Net::Clacks::Server::EVAL_ERROR)
1311 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'})
1317 0 0 if (defined $written and $written)
1318 0 0 if (length $clients{$cid}{'outbuffer'} == $written) { }
1326 0 0 if ($workCount) { }
0 0 elsif ($self->{'usleep'} < $self->{'config'}{'throttle'}{'maxsleep'}) { }
1331 0 0 if ($self->{'usleep'})
1355 0 0 unless ($self->{'persistance'})
1369 0 0 if ($savecache == 1)
1374 0 0 if (open my $ofh, ">", $tempfname)
1383 0 0 if ($savecache == 2)
1392 0 0 unless defined $val
1396 0 0 unless defined $val
1403 0 0 unless length $buffer
1411 0 0 if ($Net::Clacks::Server::EVAL_ERROR or not $ok)
1429 0 0 unless open my $fh, "<", $fname