| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Object::Remote::Handle; |
|
2
|
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
6676
|
use Object::Remote::Proxy; |
|
|
15
|
|
|
|
|
49
|
|
|
|
15
|
|
|
|
|
637
|
|
|
4
|
15
|
|
|
15
|
|
109
|
use Scalar::Util qw(weaken blessed); |
|
|
15
|
|
|
|
|
24
|
|
|
|
15
|
|
|
|
|
937
|
|
|
5
|
15
|
|
|
15
|
|
84
|
use Object::Remote::Logging qw ( :log :dlog router ); |
|
|
15
|
|
|
|
|
34
|
|
|
|
15
|
|
|
|
|
119
|
|
|
6
|
15
|
|
|
15
|
|
7718
|
use Object::Remote::Future; |
|
|
15
|
|
|
|
|
63
|
|
|
|
15
|
|
|
|
|
1317
|
|
|
7
|
15
|
|
|
15
|
|
7839
|
use Module::Runtime qw(use_module); |
|
|
15
|
|
|
|
|
27477
|
|
|
|
15
|
|
|
|
|
88
|
|
|
8
|
15
|
|
|
15
|
|
956
|
use Moo; |
|
|
15
|
|
|
|
|
24
|
|
|
|
15
|
|
|
|
|
136
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
15
|
|
|
15
|
|
10254
|
BEGIN { router()->exclude_forwarding } |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has connection => ( |
|
13
|
|
|
|
|
|
|
is => 'ro', required => 1, handles => ['is_valid'], |
|
14
|
|
|
|
|
|
|
coerce => sub { |
|
15
|
|
|
|
|
|
|
blessed($_[0]) |
|
16
|
|
|
|
|
|
|
? $_[0] |
|
17
|
|
|
|
|
|
|
: use_module('Object::Remote::Connection')->new_from_spec($_[0]) |
|
18
|
|
|
|
|
|
|
}, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has id => (is => 'rwp'); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has disarmed_free => (is => 'rwp'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
168
|
|
|
168
|
0
|
1824
|
sub disarm_free { $_[0]->_set_disarmed_free(1); $_[0] } |
|
|
168
|
|
|
|
|
479
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub proxy { |
|
28
|
110
|
|
|
110
|
0
|
1582
|
bless({ remote => $_[0], method => 'call' }, 'Object::Remote::Proxy'); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub BUILD { |
|
32
|
129
|
|
|
129
|
0
|
2903
|
my ($self, $args) = @_; |
|
33
|
129
|
|
|
0
|
|
1271
|
log_trace { "constructing remote handle" }; |
|
|
0
|
|
|
|
|
0
|
|
|
34
|
129
|
100
|
|
|
|
3043
|
if ($self->id) { |
|
35
|
89
|
|
|
0
|
|
664
|
log_trace { "disarming free for this handle" }; |
|
|
0
|
|
|
|
|
0
|
|
|
36
|
89
|
|
|
|
|
1382
|
$self->disarm_free; |
|
37
|
|
|
|
|
|
|
} else { |
|
38
|
40
|
50
|
|
|
|
196
|
die "No id supplied and no class either" unless $args->{class}; |
|
39
|
40
|
|
100
|
|
|
413
|
ref($_) eq 'HASH' and $_ = [ %$_ ] for $args->{args}; |
|
40
|
40
|
|
|
0
|
|
304
|
log_trace { "fetching id for handle and disarming free on remote side" }; |
|
|
0
|
|
|
|
|
0
|
|
|
41
|
|
|
|
|
|
|
$self->_set_id( |
|
42
|
|
|
|
|
|
|
await_future( |
|
43
|
|
|
|
|
|
|
$self->connection->send_class_call( |
|
44
|
|
|
|
|
|
|
0, $args->{class}, |
|
45
|
40
|
100
|
|
|
|
450
|
$args->{constructor}||'new', @{$args->{args}||[]} |
|
46
|
|
|
|
|
|
|
) |
|
47
|
|
|
|
|
|
|
)->{remote}->disarm_free->id |
|
48
|
40
|
|
50
|
|
|
865
|
); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
128
|
|
|
0
|
|
1910
|
Dlog_trace { "finished constructing remote handle; id is $_" } $self->id; |
|
|
0
|
|
|
|
|
0
|
|
|
51
|
128
|
|
|
|
|
2845
|
$self->connection->register_remote($self); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub call { |
|
55
|
92
|
|
|
92
|
0
|
387
|
my ($self, $method, @args) = @_; |
|
56
|
92
|
|
|
|
|
227
|
my $w = wantarray; |
|
57
|
92
|
|
|
|
|
397
|
my $id = $self->id; |
|
58
|
|
|
|
|
|
|
|
|
59
|
92
|
100
|
50
|
|
|
536
|
$method = "start::${method}" if (caller(0)||'') eq 'start'; |
|
60
|
92
|
|
|
0
|
|
750
|
log_trace { "call('$method') has been invoked on remote handle '$id'; creating future" }; |
|
|
0
|
|
|
|
|
0
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
future { |
|
63
|
92
|
|
|
92
|
|
1468
|
log_debug { "Invoking send on connection for handle '$id' method '$method'" }; |
|
|
0
|
|
|
|
|
0
|
|
|
64
|
92
|
|
|
|
|
1728
|
$self->connection->send(call => $id, $w, $method, @args) |
|
65
|
92
|
|
|
|
|
2074
|
}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub call_discard { |
|
69
|
0
|
|
|
0
|
0
|
0
|
my ($self, $method, @args) = @_; |
|
70
|
0
|
|
|
0
|
|
0
|
log_trace { "invoking send_discard() with 'call' for method '$method' on connection for remote handle" }; |
|
|
0
|
|
|
|
|
0
|
|
|
71
|
0
|
|
|
|
|
0
|
$self->connection->send_discard(call => $self->id, $method, @args); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub call_discard_free { |
|
75
|
21
|
|
|
21
|
0
|
119
|
my ($self, $method, @args) = @_; |
|
76
|
21
|
|
|
|
|
98
|
$self->disarm_free; |
|
77
|
21
|
|
|
0
|
|
219
|
log_trace { "invoking send_discard() with 'call_free' for method '$method' on connection for remote handle" }; |
|
|
0
|
|
|
|
|
0
|
|
|
78
|
21
|
|
|
|
|
490
|
$self->connection->send_discard(call_free => $self->id, $method, @args); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub DEMOLISH { |
|
82
|
127
|
|
|
127
|
0
|
55526
|
my ($self, $gd) = @_; |
|
83
|
127
|
|
|
0
|
|
1243
|
Dlog_trace { "Demolishing remote handle $_" } $self->id; |
|
|
0
|
|
|
|
|
0
|
|
|
84
|
127
|
100
|
66
|
|
|
9514
|
return if $gd or $self->disarmed_free; |
|
85
|
|
|
|
|
|
|
#this could happen after the connection has gone away |
|
86
|
19
|
|
|
|
|
76
|
eval { $self->connection->send_free($self->id) }; |
|
|
19
|
|
|
|
|
199
|
|
|
87
|
19
|
50
|
66
|
|
|
587
|
if ($@ && $@ !~ m/^Attempt to invoke _send on a connection that is not valid/) { |
|
88
|
0
|
|
|
|
|
0
|
die "Could not invoke send_free on connection for handle " . $self->id; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |