line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Twiggy::Prefork::Metabolic::Server; |
2
|
17
|
|
|
17
|
|
765
|
use strict; |
|
17
|
|
|
|
|
35
|
|
|
17
|
|
|
|
|
609
|
|
3
|
17
|
|
|
17
|
|
68
|
use warnings; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
404
|
|
4
|
|
|
|
|
|
|
|
5
|
17
|
|
|
17
|
|
435
|
use parent qw(Twiggy::Prefork::Server); |
|
17
|
|
|
|
|
383
|
|
|
17
|
|
|
|
|
332
|
|
6
|
|
|
|
|
|
|
|
7
|
17
|
|
|
17
|
|
757318
|
use constant DEBUG => $ENV{TWIGGY_DEBUG}; |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
2815
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _accept_handler { |
10
|
16
|
|
|
16
|
|
1418
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
16
|
|
|
|
|
136
|
my $cb = $self->Twiggy::Server::_accept_handler( @_ ); |
13
|
|
|
|
|
|
|
return $self->{max_reqs_per_child} == 0 ? $cb : sub { |
14
|
122
|
|
|
122
|
|
8025578
|
my ( $sock, $peer_host, $peer_port ) = @_; |
15
|
122
|
|
|
|
|
623
|
$self->{reqs_per_child}++; |
16
|
122
|
|
|
|
|
639
|
$cb->( $sock, $peer_host, $peer_port ); |
17
|
|
|
|
|
|
|
|
18
|
122
|
100
|
|
|
|
30419
|
if ( $self->{reqs_per_child} >= $self->{max_reqs_per_child} ) { |
19
|
69
|
|
|
|
|
100
|
DEBUG && warn sprintf "[%s] reach max reqs per child (%d/%d)\n", |
20
|
|
|
|
|
|
|
$$, $self->{reqs_per_child}, $self->{max_reqs_per_child}; |
21
|
69
|
100
|
|
|
|
815
|
$self->{ready_to_exit}++ and return; |
22
|
13
|
|
|
|
|
156
|
$self->{exit_guard}->end; |
23
|
|
|
|
|
|
|
} |
24
|
16
|
50
|
|
|
|
450
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |