line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Signalet::Server; |
2
|
3
|
|
|
3
|
|
1247
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
101
|
|
3
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
76
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
12
|
use parent qw(Net::Signalet); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
19
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
2
|
|
|
2
|
0
|
3838
|
my ($class, @args) = @_; |
10
|
2
|
50
|
33
|
|
|
106
|
my %args = @args == 1 && ref($args[0]) eq 'HASH' ? %{$args[0]} : @args; |
|
0
|
|
|
|
|
0
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
50
|
|
|
80
|
$args{listen} ||= 1; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
103
|
$class->SUPER::_init(%args); |
15
|
|
|
|
|
|
|
|
16
|
2
|
50
|
50
|
|
|
118
|
my $sock = IO::Socket::INET->new( |
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
17
|
|
|
|
|
|
|
Proto => 'tcp', |
18
|
|
|
|
|
|
|
LocalPort => $args{sport} || 14550, |
19
|
|
|
|
|
|
|
LocalAddr => $args{saddr} || undef, |
20
|
|
|
|
|
|
|
Listen => $args{listen}, |
21
|
|
|
|
|
|
|
Timeout => $args{timeout} || 180, |
22
|
|
|
|
|
|
|
ReuseAddr => $args{reuse} || 0, |
23
|
|
|
|
|
|
|
) or die $!; |
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
|
|
|
1464
|
$sock->listen or die $!; |
26
|
2
|
|
|
|
|
47
|
my $csock = $sock->accept; # only for one client |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
111209
|
my $self = bless { |
29
|
|
|
|
|
|
|
worker_pid => undef, |
30
|
|
|
|
|
|
|
sock => $csock, |
31
|
|
|
|
|
|
|
ssock => $sock, |
32
|
|
|
|
|
|
|
}, $class; |
33
|
2
|
|
|
|
|
32
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub close { |
37
|
1
|
|
|
1
|
0
|
67
|
my ($self) = @_; |
38
|
1
|
|
|
|
|
13
|
$self->SUPER::close; |
39
|
1
|
|
|
|
|
20
|
close $self->{ssock}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |