line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MogileFS::Connection::Parent; |
2
|
|
|
|
|
|
|
# maintains a connection in a worker process to the parent ProcManager process |
3
|
|
|
|
|
|
|
# Only used by workers that use the Danga::Socket->EventLoop internally |
4
|
|
|
|
|
|
|
# currently only Monitor |
5
|
21
|
|
|
21
|
|
114
|
use warnings; |
|
21
|
|
|
|
|
33
|
|
|
21
|
|
|
|
|
537
|
|
6
|
21
|
|
|
21
|
|
83
|
use strict; |
|
21
|
|
|
|
|
35
|
|
|
21
|
|
|
|
|
325
|
|
7
|
21
|
|
|
21
|
|
78
|
use Danga::Socket (); |
|
21
|
|
|
|
|
31
|
|
|
21
|
|
|
|
|
325
|
|
8
|
21
|
|
|
21
|
|
81
|
use base qw{Danga::Socket}; |
|
21
|
|
|
|
|
41
|
|
|
21
|
|
|
|
|
2411
|
|
9
|
21
|
|
|
21
|
|
130
|
use fields qw(worker); |
|
21
|
|
|
|
|
29
|
|
|
21
|
|
|
|
|
105
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
1
|
|
my ($self, $worker) = @_; |
13
|
0
|
0
|
|
|
|
|
$self = fields::new($self) unless ref $self; |
14
|
0
|
|
|
|
|
|
$self->SUPER::new($worker->psock); |
15
|
0
|
|
|
|
|
|
$self->{worker} = $worker; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub ping { |
21
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$self->write(":ping\r\n"); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub event_read { |
27
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$self->{worker}->read_from_parent; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub event_hup { $_[0]->close } |
33
|
0
|
|
|
0
|
1
|
|
sub event_err { $_[0]->close } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |