line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::HTTP2::Frame::Ping; |
2
|
12
|
|
|
12
|
|
39
|
use strict; |
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
260
|
|
3
|
12
|
|
|
12
|
|
34
|
use warnings; |
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
239
|
|
4
|
12
|
|
|
12
|
|
37
|
use Protocol::HTTP2::Constants qw(:flags :errors :limits); |
|
12
|
|
|
|
|
10
|
|
|
12
|
|
|
|
|
2124
|
|
5
|
12
|
|
|
12
|
|
49
|
use Protocol::HTTP2::Trace qw(tracer); |
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
1931
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub decode { |
8
|
2
|
|
|
2
|
0
|
3
|
my ( $con, $buf_ref, $buf_offset, $length ) = @_; |
9
|
2
|
|
|
|
|
3
|
my $frame_ref = $con->decode_context->{frame}; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# PING associated with connection |
12
|
2
|
50
|
|
|
|
6
|
if ( $frame_ref->{stream} != 0 ) { |
13
|
0
|
|
|
|
|
0
|
$con->error(PROTOCOL_ERROR); |
14
|
0
|
|
|
|
|
0
|
return undef; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# payload is 8 octets |
18
|
2
|
50
|
|
|
|
3
|
if ( $length != PING_PAYLOAD_SIZE ) { |
19
|
0
|
|
|
|
|
0
|
$con->error(FRAME_SIZE_ERROR); |
20
|
0
|
|
|
|
|
0
|
return undef; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$con->ack_ping( \substr $$buf_ref, $buf_offset, $length ) |
24
|
2
|
100
|
|
|
|
9
|
unless $frame_ref->{flags} & ACK; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
5
|
return $length; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub encode { |
30
|
4
|
|
|
4
|
0
|
8
|
my ( $con, $flags_ref, $stream, $data_ref ) = @_; |
31
|
4
|
50
|
|
|
|
9
|
if ( length($$data_ref) != PING_PAYLOAD_SIZE ) { |
32
|
0
|
|
|
|
|
0
|
$con->error(INTERNAL_ERROR); |
33
|
0
|
|
|
|
|
0
|
return undef; |
34
|
|
|
|
|
|
|
} |
35
|
4
|
|
|
|
|
6
|
return $$data_ref; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |