| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Object::Remote::Role::Connector; |
|
2
|
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
10183
|
use Module::Runtime qw(use_module); |
|
|
14
|
|
|
|
|
35
|
|
|
|
14
|
|
|
|
|
154
|
|
|
4
|
14
|
|
|
14
|
|
1179
|
use Object::Remote::Future; |
|
|
14
|
|
|
|
|
31
|
|
|
|
14
|
|
|
|
|
1354
|
|
|
5
|
14
|
|
|
14
|
|
90
|
use Object::Remote::Logging qw(:log :dlog router); |
|
|
14
|
|
|
|
|
27
|
|
|
|
14
|
|
|
|
|
131
|
|
|
6
|
14
|
|
|
14
|
|
174
|
use Moo::Role; |
|
|
14
|
|
|
|
|
32
|
|
|
|
14
|
|
|
|
|
307
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires '_open2_for'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has timeout => (is => 'ro', default => sub { 10 }); |
|
11
|
|
|
|
|
|
|
|
|
12
|
14
|
|
|
14
|
|
20158
|
BEGIN { router()->exclude_forwarding; } |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub connect { |
|
15
|
20
|
|
|
20
|
0
|
56
|
my $self = shift; |
|
16
|
20
|
|
|
0
|
|
323
|
Dlog_debug { "Preparing to create connection with args of: $_" } @_; |
|
|
0
|
|
|
|
|
0
|
|
|
17
|
20
|
|
|
|
|
458
|
my ($send_to_fh, $receive_from_fh, $child_pid) = $self->_open2_for(@_); |
|
18
|
20
|
|
|
|
|
336
|
my $channel = use_module('Object::Remote::ReadChannel')->new( |
|
19
|
|
|
|
|
|
|
fh => $receive_from_fh |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
return future { |
|
22
|
20
|
|
|
20
|
|
810
|
log_trace { "Initializing connection for child pid '$child_pid'" }; |
|
|
0
|
|
|
|
|
0
|
|
|
23
|
20
|
|
|
|
|
336
|
my $f = shift; |
|
24
|
|
|
|
|
|
|
$channel->on_line_call(sub { |
|
25
|
19
|
50
|
|
|
|
106
|
if ($_[0] eq "Shere") { |
|
26
|
19
|
|
|
|
|
352
|
log_trace { "Received 'Shere' from child pid '$child_pid'; setting done handler to create connection" }; |
|
|
0
|
|
|
|
|
0
|
|
|
27
|
19
|
|
|
|
|
385
|
$f->done( |
|
28
|
|
|
|
|
|
|
use_module('Object::Remote::Connection')->new( |
|
29
|
|
|
|
|
|
|
send_to_fh => $send_to_fh, |
|
30
|
|
|
|
|
|
|
read_channel => $channel, |
|
31
|
|
|
|
|
|
|
child_pid => $child_pid, |
|
32
|
|
|
|
|
|
|
) |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
} else { |
|
35
|
0
|
|
|
|
|
0
|
log_warn { "'Shere' was not found in connection data for child pid '$child_pid'" }; |
|
|
0
|
|
|
|
|
0
|
|
|
36
|
0
|
|
|
|
|
0
|
$f->fail("Expected Shere from remote but received: $_[0]"); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
19
|
|
|
|
|
933
|
undef($channel); |
|
39
|
20
|
|
|
|
|
476
|
}); |
|
40
|
|
|
|
|
|
|
$channel->on_close_call(sub { |
|
41
|
0
|
|
|
|
|
0
|
log_trace { "Connection has been closed" }; |
|
|
0
|
|
|
|
|
0
|
|
|
42
|
0
|
|
|
|
|
0
|
$f->fail("Channel closed without seeing Shere: $_[0]"); |
|
43
|
0
|
|
|
|
|
0
|
undef($channel); |
|
44
|
20
|
|
|
|
|
191
|
}); |
|
45
|
20
|
|
|
|
|
457
|
log_trace { "initialized events on channel for child pid '$child_pid'; creating timeout" }; |
|
|
0
|
|
|
|
|
0
|
|
|
46
|
|
|
|
|
|
|
Object::Remote->current_loop |
|
47
|
|
|
|
|
|
|
->watch_time( |
|
48
|
|
|
|
|
|
|
after => $self->timeout, |
|
49
|
|
|
|
|
|
|
code => sub { |
|
50
|
1
|
|
|
|
|
14
|
Dlog_trace {"Connection timeout timer has fired for child pid '$child_pid'; is_ready: $_" } $f->is_ready; |
|
|
0
|
|
|
|
|
0
|
|
|
51
|
1
|
50
|
|
|
|
18
|
unless($f->is_ready) { |
|
52
|
1
|
|
|
|
|
15
|
log_warn { "Connection with child pid '$child_pid' has timed out" }; |
|
|
0
|
|
|
|
|
0
|
|
|
53
|
1
|
50
|
|
|
|
14
|
$f->fail("Connection timed out") unless $f->is_ready; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
1
|
|
|
|
|
31
|
undef($channel); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
20
|
|
|
|
|
350
|
); |
|
59
|
20
|
|
|
|
|
419
|
log_trace { "connection for child pid '$child_pid' has been initialized" }; |
|
|
0
|
|
|
|
|
0
|
|
|
60
|
20
|
|
|
|
|
430
|
$f; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
20
|
|
|
|
|
836
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |