line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::IMP::Remote::Sereal; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1764
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
67
|
|
5
|
2
|
|
|
2
|
|
12
|
use Net::IMP::Remote::Protocol; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
219
|
|
6
|
2
|
|
|
2
|
|
16
|
use Net::IMP qw(:DEFAULT :log); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
490
|
|
7
|
2
|
|
|
2
|
|
16
|
use Net::IMP::Debug; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
8
|
2
|
|
|
2
|
|
278
|
use Net::IMP::Remote::DualvarMapping; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
155
|
|
9
|
2
|
|
|
2
|
|
16
|
use Sereal::Encoder 0.36; |
|
2
|
|
|
|
|
75
|
|
|
2
|
|
|
|
|
82
|
|
10
|
2
|
|
|
2
|
|
14
|
use Sereal::Decoder 0.36; |
|
2
|
|
|
|
|
45
|
|
|
2
|
|
|
|
|
778
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $wire_version = 0x00000001; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
0
|
361
|
bless { |
16
|
|
|
|
|
|
|
encoder => Sereal::Encoder->new, |
17
|
|
|
|
|
|
|
decoder => Sereal::Decoder->new({ incremental => 1 }), |
18
|
|
|
|
|
|
|
}, shift; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub buf2rpc { |
22
|
35
|
|
|
35
|
0
|
2406
|
my ($self,$rdata) = @_; |
23
|
35
|
|
|
|
|
43
|
decode: |
24
|
|
|
|
|
|
|
my $out = undef; |
25
|
35
|
100
|
|
|
|
55
|
eval { $self->{decoder}->decode( $$rdata, $out ) } or return; |
|
35
|
|
|
|
|
274
|
|
26
|
12
|
50
|
|
|
|
28
|
return if ! $out; |
27
|
12
|
100
|
|
|
|
31
|
if ( $out->[0] == IMPRPC_SET_VERSION ) { |
28
|
1
|
50
|
|
|
|
4
|
die "wrong version $out->[1], can do $wire_version only" |
29
|
|
|
|
|
|
|
if $out->[1] != $wire_version; |
30
|
1
|
50
|
|
|
|
5
|
return if $$rdata eq ''; |
31
|
0
|
|
|
|
|
0
|
goto decode; |
32
|
|
|
|
|
|
|
} |
33
|
11
|
|
|
|
|
28
|
return rpc_i2d($out); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub rpc2buf { |
37
|
12
|
|
|
12
|
0
|
17646
|
my ($self,$rpc) = @_; |
38
|
12
|
|
|
|
|
39
|
$self->{encoder}->encode(rpc_d2i($rpc)) |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
1
|
|
|
1
|
0
|
615
|
my ($self,$side) = @_; |
43
|
1
|
50
|
|
|
|
5
|
return if $side == 0; |
44
|
1
|
|
|
|
|
4
|
$self->rpc2buf([IMPRPC_SET_VERSION,$wire_version]) |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |