HTTP2/Frame/Ping.pm

filter: Statementstmt 78.5% 22 / 28 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 75.0% 33 / 44 CC 5 SCAR 10.3
CC
5
Cov
75%
decode
4.8
encode
2.3
BEGIN
1.0
CRAP 2.8
« HTTP2/Frame/Priority.pm ↑ Summary HTTP2/Huffman.pm »
1 package Protocol::HTTP2::Frame::Ping;
2 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use Protocol::HTTP2::Constants qw(:flags :errors :limits);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use Protocol::HTTP2::Trace qw(tracer);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶sub decode {
Subroutine decode: called CC=4 SCAR=15.8
Pod undocumented
8 2 my ( $con, $buf_ref, $buf_offset, $length ) = @_;
9 2 my $frame_ref = $con->decode_context->{frame};
10  
11 # PING associated with connection
12 2 ▶ if ( $frame_ref->{stream} != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frame_ref->{"stream"} != 0) 0 2 2
13 0 $con->error(PROTOCOL_ERROR);
14 0 return undef;
15 }
16  
17 # payload is 8 octets
18 2 ▶ if ( $length != PING_PAYLOAD_SIZE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length != 8) 0 2 2
19 0 $con->error(FRAME_SIZE_ERROR);
20 0 return undef;
21 }
22  
23 $con->ack_ping( \substr $$buf_ref, $buf_offset, $length )
24 2 ▶ unless $frame_ref->{flags} & ACK;
Branch: 1 branch
BranchTrueFalseTotal
unless $frame_ref->{"flags"} & 1 1 1 2
25  
26 2 return $length;
27 }
28  
29 4 ▶sub encode {
Subroutine encode: called CC=2 SCAR=8.4
Pod undocumented
30 4 my ( $con, $flags_ref, $stream, $data_ref ) = @_;
31 4 ▶ if ( length($$data_ref) != PING_PAYLOAD_SIZE ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $$data_ref != 8) 0 4 4
32 0 $con->error(INTERNAL_ERROR);
33 0 return undef;
34 }
35 4 return $$data_ref;
36 }
37  
38 13 1;
« HTTP2/Frame/Priority.pm ↑ Summary HTTP2/Huffman.pm »