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