line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::IMP::Remote::Sereal; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1563
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
86
|
|
4
|
2
|
|
|
2
|
|
22
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
5
|
2
|
|
|
2
|
|
11
|
use Net::IMP::Remote::Protocol; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
225
|
|
6
|
2
|
|
|
2
|
|
14
|
use Net::IMP qw(:DEFAULT :log); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
678
|
|
7
|
2
|
|
|
2
|
|
12
|
use Net::IMP::Debug; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
8
|
2
|
|
|
2
|
|
197
|
use Net::IMP::Remote::DualvarMapping; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
122
|
|
9
|
2
|
|
|
2
|
|
9
|
use Sereal::Encoder 0.36; |
|
2
|
|
|
|
|
76
|
|
|
2
|
|
|
|
|
70
|
|
10
|
2
|
|
|
2
|
|
11
|
use Sereal::Decoder 0.36; |
|
2
|
|
|
|
|
48
|
|
|
2
|
|
|
|
|
698
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $wire_version = 0x00000001; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
0
|
309
|
bless { |
16
|
|
|
|
|
|
|
encoder => Sereal::Encoder->new, |
17
|
|
|
|
|
|
|
decoder => Sereal::Decoder->new({ incremental => 1 }), |
18
|
|
|
|
|
|
|
}, shift; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub buf2rpc { |
22
|
35
|
|
|
35
|
0
|
12230
|
my ($self,$rdata) = @_; |
23
|
35
|
|
|
|
|
46
|
decode: |
24
|
|
|
|
|
|
|
my $out = undef; |
25
|
35
|
100
|
|
|
|
45
|
eval { $self->{decoder}->decode( $$rdata, $out ) } or return; |
|
35
|
|
|
|
|
1536
|
|
26
|
12
|
50
|
|
|
|
29
|
return if ! $out; |
27
|
12
|
100
|
|
|
|
36
|
if ( $out->[0] == IMPRPC_SET_VERSION ) { |
28
|
1
|
50
|
|
|
|
3
|
die "wrong version $out->[1], can do $wire_version only" |
29
|
|
|
|
|
|
|
if $out->[1] != $wire_version; |
30
|
1
|
50
|
|
|
|
6
|
return if $$rdata eq ''; |
31
|
0
|
|
|
|
|
0
|
goto decode; |
32
|
|
|
|
|
|
|
} |
33
|
11
|
|
|
|
|
40
|
return rpc_i2d($out); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub rpc2buf { |
37
|
12
|
|
|
12
|
0
|
51492
|
my ($self,$rpc) = @_; |
38
|
12
|
|
|
|
|
102
|
$self->{encoder}->encode(rpc_d2i($rpc)) |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
1
|
|
|
1
|
0
|
324
|
my ($self,$side) = @_; |
43
|
1
|
50
|
|
|
|
4
|
return if $side == 0; |
44
|
1
|
|
|
|
|
4
|
$self->rpc2buf([IMPRPC_SET_VERSION,$wire_version]) |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |