line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Server::Starter adapter for Feersum Plack handler |
2
|
|
|
|
|
|
|
package Plack::Handler::Feersum::SS; |
3
|
|
|
|
|
|
|
$Plack::Handler::Feersum::SS::VERSION = '0.03'; |
4
|
1
|
|
|
1
|
|
70655
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Plack::Handler::Feersum'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
591
|
|
7
|
1
|
|
|
1
|
|
40372
|
use Feersum; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
8
|
1
|
|
|
1
|
|
576
|
use Server::Starter 'server_ports'; |
|
1
|
|
|
|
|
7791
|
|
|
1
|
|
|
|
|
63
|
|
9
|
1
|
|
|
1
|
|
8
|
use Carp 'croak'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
10
|
1
|
|
|
1
|
|
6
|
use Symbol 'geniosym'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
11
|
1
|
|
|
1
|
|
5
|
use Fcntl qw'F_GETFL F_SETFL O_NONBLOCK'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
321
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# redefining (origins: Feersum::Runner, Plack::Handler::Feersum) |
14
|
|
|
|
|
|
|
sub _prepare { |
15
|
0
|
|
|
0
|
|
|
my $self = shift; |
16
|
0
|
0
|
|
|
|
|
delete $self->{quiet} if delete $self->{verbose}; |
17
|
0
|
|
|
|
|
|
my %ports = %{server_ports()}; |
|
0
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
croak "Feersum doesn't support none/multiple listen directives yet" unless %ports == 1; |
19
|
0
|
|
|
|
|
|
my ($port, $fd) = each %ports; |
20
|
0
|
0
|
|
|
|
|
open(my $sock = geniosym, "<&=", $fd) || croak $!; |
21
|
0
|
0
|
|
|
|
|
my $flags = fcntl($sock, F_GETFL, 0) or croak $!; |
22
|
0
|
0
|
|
|
|
|
fcntl($sock, F_SETFL, $flags | O_NONBLOCK) || croak $!; |
23
|
0
|
0
|
|
|
|
|
print "Feersum [$$] listening on $port fd=$fd\n" unless $self->{quiet}; |
24
|
0
|
|
|
|
|
|
$self->{sock} = $sock; |
25
|
0
|
|
|
|
|
|
$self->{listen} = [$port]; |
26
|
0
|
|
|
|
|
|
my $f = $self->{endjinn} = Feersum->endjinn; |
27
|
0
|
|
|
|
|
|
$f->use_socket($sock); |
28
|
0
|
0
|
|
|
|
|
$self->{pre_fork} = delete $self->{options}{pre_fork} if $self->{options}; |
29
|
|
|
|
|
|
|
$self->{server_ready}->({ |
30
|
|
|
|
|
|
|
qw'server_software Feersum', |
31
|
|
|
|
|
|
|
$port =~ m/^(?:(.+?):|)([0-9]+)$/ ? (host => $1//0, port => $2) : (host => 'unix/', port => $port) |
32
|
0
|
0
|
0
|
|
|
|
}) if $self->{server_ready}; |
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |