| line |
true |
false |
branch |
|
12
|
0 |
10 |
unless (eval {
do {
"Socket"->import("AF_INET6", "inet_pton", "pack_sockaddr_in6");
1
}
}) |
|
21
|
0 |
10 |
unless eval {
do {
"Socket"->import("SO_REUSEPORT");
1
}
} |
|
38
|
2 |
17 |
if ($INSTANCE) |
|
40
|
0 |
2 |
if $Feersum::Runner::INSTANCE->{'running'} |
|
51
|
2 |
18 |
if $self->{'_cleaned_up'} |
|
53
|
6 |
12 |
if (my $f = $self->{'endjinn'}) |
|
59
|
0 |
18 |
if (my $file = $self->{'pid_file'}) |
|
60
|
0 |
0 |
if -f $file |
|
75
|
0 |
14 |
if ($listen =~ m[^[/\.]+\w]) { } |
|
77
|
0 |
0 |
if (-S $listen) |
|
78
|
0 |
0 |
unless unlink $listen |
|
89
|
0 |
0 |
if $err |
|
90
|
0 |
0 |
unless $sock |
|
91
|
0 |
0 |
unless ($sock->blocking(0)) |
|
96
|
0 |
14 |
if ($use_reuseport and defined 15) { } |
|
99
|
0 |
0 |
if ($listen =~ /^\[([^\]]+)\]:(\d*)$/) { } |
|
|
0 |
0 |
elsif ($listen =~ /^\[([^\]]+)\]$/) { } |
|
|
0 |
0 |
elsif ($listen =~ /:.*:/) { } |
|
107
|
0 |
0 |
if ($listen =~ /:(\d{1,5})$/) |
|
110
|
0 |
0 |
if ($maybe_port <= 65535 and length $maybe_port == 5 || $maybe_port >= 1024) |
|
125
|
0 |
0 |
if (not $port =~ /^\d+$/ or $port > 65535) |
|
130
|
0 |
0 |
if ($is_ipv6) { } |
|
131
|
0 |
0 |
unless defined 10 |
|
133
|
0 |
0 |
unless my $addr = inet_pton(10, $host) |
|
138
|
0 |
0 |
unless my $addr = inet_aton($host) |
|
145
|
0 |
0 |
unless socket $sock, $domain, 1, 0 |
|
148
|
0 |
0 |
unless (setsockopt $sock, 1, 2, "\1\0\0\0") |
|
150
|
0 |
0 |
unless (setsockopt $sock, 1, 15, "\1\0\0\0") |
|
152
|
0 |
0 |
unless (bind $sock, $sockaddr) |
|
154
|
0 |
0 |
unless (listen $sock, $backlog) |
|
160
|
0 |
0 |
unless ($sock->blocking(0)) |
|
164
|
14 |
0 |
if ($listen =~ /:(\d+)$/) { } |
|
|
0 |
0 |
elsif ($listen =~ /:(\S+)$/) { } |
|
166
|
0 |
14 |
if $port > 65535 |
|
169
|
0 |
0 |
unless $port =~ /^\d+$/ |
|
178
|
0 |
14 |
unless $sock |
|
186
|
0 |
3 |
if (my $opts = $self->{'options'}) |
|
232
|
170 |
0 |
$consume ? : |
|
233
|
2 |
168 |
if defined $val |
|
235
|
10 |
0 |
if ($f->can("max_h2_concurrent_streams")) |
|
237
|
10 |
0 |
$consume ? : |
|
238
|
0 |
10 |
if defined $v |
|
248
|
0 |
0 |
unless my $max = $self->{'max_requests_per_worker'} |
|
250
|
0 |
0 |
if ($f->total_requests >= $max) |
|
263
|
0 |
0 |
if ($sni) |
|
264
|
0 |
0 |
unless ref $sni eq "ARRAY" |
|
275
|
0 |
13 |
if (defined $self->{'listen'} and not ref $self->{'listen'}) |
|
281
|
0 |
13 |
if ref $self->{'listen'} ne "ARRAY" |
|
283
|
0 |
13 |
if @{$self->{'listen'};} == 0 |
|
293
|
3 |
10 |
if ($self->{'pre_fork'}) |
|
295
|
0 |
3 |
if (not $n =~ /^\d+$/ or $n < 1) |
|
298
|
0 |
3 |
if ($n > 1000) |
|
311
|
2 |
0 |
if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux") |
|
327
|
31 |
5 |
unless defined $val |
|
328
|
0 |
5 |
unless $val =~ /^-?\d+$/ |
|
329
|
3 |
2 |
if $val < -2 or $val > 2 |
|
331
|
0 |
10 |
if (defined(my $val = $self->{'max_accept_per_loop'})) |
|
332
|
0 |
0 |
unless $val =~ /^\d+$/ and $val > 0 |
|
335
|
0 |
10 |
if (defined(my $val = $self->{'max_connections'})) |
|
336
|
0 |
0 |
unless $val =~ /^\d+$/ |
|
342
|
8 |
2 |
if (not $self->{'tls'}) { } |
|
343
|
1 |
7 |
if (my $cert = delete $self->{'tls_cert_file'}) { } |
|
|
1 |
6 |
elsif (delete $self->{'tls_key_file'}) { } |
|
345
|
1 |
0 |
unless my $key = delete $self->{'tls_key_file'} |
|
357
|
2 |
6 |
if (my $tls = delete $self->{'tls'}) { } |
|
358
|
0 |
2 |
unless ref $tls eq "HASH" |
|
359
|
0 |
2 |
unless $tls->{'cert_file'} |
|
360
|
0 |
2 |
unless $tls->{'key_file'} |
|
361
|
2 |
0 |
unless -f $tls->{'cert_file'} and -r _ |
|
363
|
0 |
0 |
unless -f $tls->{'key_file'} and -r _ |
|
367
|
0 |
0 |
if (delete $self->{'h2'}) |
|
371
|
0 |
0 |
if ($f->has_tls) { } |
|
374
|
0 |
0 |
unless $self->{'quiet'} |
|
380
|
0 |
6 |
if (delete $self->{'h2'}) |
|
392
|
0 |
3 |
if (my $log_cb = $self->{'access_log'}) |
|
414
|
0 |
3 |
unless $self->{'quiet'} |
|
420
|
0 |
3 |
if ($self->{'hot_restart'}) |
|
421
|
0 |
0 |
unless $self->{'app_file'} |
|
433
|
0 |
3 |
if ($self->{'pre_fork'} and defined $self->{'preload_app'} and not $self->{'preload_app'}) { } |
|
436
|
0 |
0 |
if (not $a and $self->{'app_file'}) |
|
439
|
0 |
0 |
if $@ or not $a |
|
441
|
0 |
0 |
unless $a |
|
449
|
0 |
0 |
if $self |
|
453
|
3 |
0 |
if (not $app and $self->{'app_file'}) |
|
456
|
0 |
3 |
if $@ |
|
457
|
0 |
3 |
if $! and not defined $app |
|
458
|
0 |
3 |
unless $app |
|
461
|
0 |
3 |
unless $app |
|
465
|
6 |
0 |
if $self |
|
467
|
3 |
0 |
if $self->{'pre_fork'} |
|
470
|
0 |
3 |
unless $self->{'quiet'} |
|
482
|
0 |
0 |
unless $quiet |
|
513
|
0 |
0 |
unless defined $pid |
|
515
|
0 |
0 |
if ($pid == 0) |
|
518
|
0 |
0 |
unless $quiet |
|
536
|
0 |
0 |
if ($@ or not $app or ref $app ne "CODE") |
|
547
|
0 |
0 |
if ($self->{'pre_fork'}) |
|
559
|
0 |
0 |
if ($self->{'pre_fork'}) |
|
564
|
0 |
0 |
if ($self->{'_use_reuseport'} and $^O eq "linux") |
|
566
|
0 |
0 |
if $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive") |
|
576
|
0 |
0 |
unless ($self->{'pre_fork'}) |
|
577
|
0 |
0 |
if $self->{'after_fork'} |
|
585
|
0 |
0 |
$self->{'pre_fork'} ? : |
|
|
0 |
0 |
unless $quiet |
|
595
|
0 |
0 |
unless (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) |
|
596
|
0 |
0 |
if kill 0, $pending_pid |
|
603
|
0 |
0 |
unless $quiet |
|
606
|
0 |
0 |
if $shutting_down or $pending_pid |
|
607
|
0 |
0 |
unless $quiet |
|
612
|
0 |
0 |
if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { } |
|
613
|
0 |
0 |
unless $quiet |
|
616
|
0 |
0 |
if $old_pid |
|
619
|
0 |
0 |
if kill 0, $pending_pid |
|
626
|
0 |
0 |
if $shutting_down |
|
628
|
0 |
0 |
unless $quiet |
|
629
|
0 |
0 |
if $current_pid |
|
632
|
0 |
0 |
if $pending_pid |
|
636
|
0 |
0 |
if $shutting_down |
|
638
|
0 |
0 |
unless $quiet |
|
639
|
0 |
0 |
if $current_pid |
|
640
|
0 |
0 |
if $pending_pid |
|
647
|
0 |
0 |
unless $quiet |
|
649
|
0 |
0 |
if $pending_pid and $kid == $pending_pid |
|
650
|
0 |
0 |
if ($current_pid and $kid == $current_pid) |
|
652
|
0 |
0 |
if $shutting_down |
|
653
|
0 |
0 |
unless ($shutting_down or $pending_pid) |
|
656
|
0 |
0 |
if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { } |
|
661
|
0 |
0 |
if kill 0, $pending_pid |
|
674
|
0 |
0 |
unless $quiet |
|
703
|
0 |
0 |
$self->{'epoll_exclusive'} ? : |
|
|
0 |
0 |
if defined $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive") |
|
706
|
0 |
0 |
if (my $tls = $self->{'tls'}) |
|
707
|
0 |
0 |
if ($f->has_tls) |
|
708
|
0 |
0 |
unless $self->{'_master_socks'} |
|
719
|
0 |
20 |
unless defined $pid |
|
720
|
0 |
20 |
unless ($pid) |
|
722
|
0 |
0 |
unless $self->{'quiet'} |
|
729
|
0 |
0 |
if ($self->{'_use_reuseport'}) |
|
731
|
0 |
0 |
unless $self->{'_socks'} |
|
733
|
0 |
0 |
unless (close $old_sock) |
|
743
|
0 |
0 |
unless (eval {
do {
foreach my $listen (@{$$self{"_listen_addrs"};}) {
my $sock = $self->_create_socket($listen, 1);
push @new_socks, $sock;
$self->{'endjinn'}->use_socket($sock);
};
1
}
}) |
|
751
|
0 |
0 |
if (my $tls = $self->{'_tls_config'}) |
|
758
|
0 |
0 |
if (my $loader = $self->{'_app_loader'}) |
|
760
|
0 |
0 |
if ($@) |
|
766
|
0 |
0 |
if (my $cb = $self->{'after_fork'}) |
|
771
|
0 |
0 |
if $@ |
|
772
|
0 |
0 |
$@ ? : |
|
779
|
0 |
20 |
unless $self |
|
780
|
0 |
20 |
unless $self->{'quiet'} |
|
783
|
20 |
0 |
if ($self->{'_shutdown'}) |
|
784
|
3 |
17 |
unless ($self->{'_n_kids'}) |
|
791
|
0 |
0 |
if ($self->{'_use_reuseport'}) { } |
|
793
|
0 |
0 |
unless $self->{'_socks'} |
|
796
|
0 |
0 |
unless (defined fileno $sock) |
|
801
|
0 |
0 |
if ($all_valid) { } |
|
825
|
0 |
3 |
unless POSIX::setsid() |
|
836
|
0 |
3 |
if ($self->{'_use_reuseport'}) |
|
837
|
0 |
0 |
unless $self->{'_socks'} |
|
838
|
0 |
0 |
unless close $sock |
|
850
|
0 |
3 |
if ($self->{'daemonize'}) { } |
|
|
0 |
3 |
elsif (my $file = $self->{'pid_file'}) { } |
|
852
|
0 |
0 |
unless defined $pid |
|
853
|
0 |
0 |
if ($pid) |
|
854
|
0 |
0 |
if (my $file = $self->{'pid_file'}) |
|
855
|
0 |
0 |
unless open my $fh, ">", $file |
|
862
|
0 |
0 |
unless open STDIN, "<", "/dev/null" |
|
863
|
0 |
0 |
unless open STDOUT, ">", "/dev/null" |
|
865
|
0 |
0 |
unless $ENV{'FEERSUM_DEBUG'} |
|
867
|
0 |
0 |
unless open my $fh, ">", $file |
|
875
|
1 |
4 |
if (my $group = $self->{'group'}) |
|
877
|
1 |
0 |
unless defined $gid |
|
882
|
0 |
0 |
if $! |
|
883
|
0 |
0 |
unless POSIX::setgid($gid) |
|
887
|
0 |
0 |
unless @rg == 1 and $rg[0] == $gid |
|
890
|
1 |
3 |
if (my $user = $self->{'user'}) |
|
892
|
1 |
0 |
unless defined $uid |
|
893
|
0 |
0 |
unless POSIX::setuid($uid) |
|
895
|
0 |
0 |
unless $< == $uid and $> == $uid |
|
902
|
3 |
3 |
if $self->{'_shutdown'} |
|
905
|
0 |
3 |
unless $self->{'quiet'} |
|
910
|
3 |
0 |
if ($self->{'_n_kids'}) { } |