| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MR::IProto::Connection; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MR::IProto::Connection - base communication class |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Base class for sync and async connections. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
865
|
use Mouse; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 server |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=over |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=item server |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Instanse of L. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has server => ( |
|
26
|
|
|
|
|
|
|
is => 'ro', |
|
27
|
|
|
|
|
|
|
isa => 'MR::IProto::Cluster::Server', |
|
28
|
|
|
|
|
|
|
required => 1, |
|
29
|
|
|
|
|
|
|
weak_ref => 1, |
|
30
|
|
|
|
|
|
|
handles => [qw( |
|
31
|
|
|
|
|
|
|
host |
|
32
|
|
|
|
|
|
|
port |
|
33
|
|
|
|
|
|
|
connect_timeout |
|
34
|
|
|
|
|
|
|
timeout |
|
35
|
|
|
|
|
|
|
tcp_nodelay |
|
36
|
|
|
|
|
|
|
tcp_keepalive |
|
37
|
|
|
|
|
|
|
max_parallel |
|
38
|
|
|
|
|
|
|
_send_started |
|
39
|
|
|
|
|
|
|
_recv_finished |
|
40
|
|
|
|
|
|
|
_debug |
|
41
|
|
|
|
|
|
|
_debug_dump |
|
42
|
|
|
|
|
|
|
)], |
|
43
|
|
|
|
|
|
|
); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _pack_header { |
|
50
|
0
|
|
|
0
|
|
|
my ($self, $msg, $length, $sync) = @_; |
|
51
|
0
|
|
|
|
|
|
return pack 'L3', $msg, $length, $sync; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _unpack_header { |
|
55
|
0
|
|
|
0
|
|
|
my ($self, $header) = @_; |
|
56
|
0
|
|
|
|
|
|
return unpack 'L3', $header; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _choose_sync { |
|
60
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
61
|
0
|
|
|
|
|
|
return 1 + int rand 0xfffffffe; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
|
533
|
no Mouse; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
65
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |