HTTP2/Frame/Window_update.pm

filter: Statementstmt 67.5% 25 / 37 Branchbran 33.3% 4 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 56.4% 35 / 62 CC 8 SCAR 26.9
CC
8
Cov
56%
decode
23.4
BEGIN
1.0
BEGIN
1.0
CRAP 14.8
« HTTP2/Frame/Data.pm ↑ Summary HTTP2/Frame.pm »
1 package Protocol::HTTP2::Frame::Window_update;
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 1 ▶sub decode {
Subroutine decode: called CC=8 SCAR=31.5
Pod undocumented
8 1 my ( $con, $buf_ref, $buf_offset, $length ) = @_;
9 1 my $frame_ref = $con->decode_context->{frame};
10  
11 1 ▶ if ( $length != 4 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length != 4) 0 1 1
12 0 tracer->error(
13 "Received windows_update frame with invalid length $length");
14 0 $con->error(FRAME_SIZE_ERROR);
15 0 return undef;
16 }
17  
18 1 my $fcw_add = unpack 'N', substr $$buf_ref, $buf_offset, 4;
19 1 $fcw_add &= 0x7FFF_FFFF;
20  
21 1 ▶ if ( $fcw_add == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fcw_add == 0) 0 1 1
22 0 tracer->error("Received flow-control window increment of 0");
23 0 $con->error(PROTOCOL_ERROR);
24 0 return undef;
25 }
26  
27 1 ▶ if ( $frame_ref->{stream} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frame_ref->{'stream'} == 0) { } 1 0 1
28 1 ▶ if ( $con->fcw_send($fcw_add) > MAX_FCW_SIZE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($con->fcw_send($fcw_add) > 2147483647) { } 0 1 1
29 0 $con->error(FLOW_CONTROL_ERROR);
30 }
31 else {
32 1 $con->send_blocked();
33 }
34 }
35 else {
36 0 my $fcw = $con->stream_fcw_send( $frame_ref->{stream}, $fcw_add );
37 0 ▶ if ( defined $fcw && $fcw > MAX_FCW_SIZE ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $fcw and $fcw > 2147483647) { } 0 0 0
elsif (defined $fcw) { } 0 0 0
Condition0%0/3
defined $fcw and $fcw > 2147483647
!ll&&!rl&&r
000
MC/DC0%0/2
defined $fcw and $fcw > 2147483647
defined $fcw $fcw > 2147483647
Truth table0%0/3
A and B
A= defined $fcwB= $fcw > 2147483647
ABresult
0X0
100
111
38 0 tracer->warning("flow-control window size exceeded MAX_FCW_SIZE");
39 0 $con->stream_error( $frame_ref->{stream}, FLOW_CONTROL_ERROR );
40 }
41 elsif ( defined $fcw ) {
42 0 $con->stream_send_blocked( $frame_ref->{stream} );
43 }
44 }
45 1 return $length;
46 }
47  
48 1 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod undocumented
49 1 my ( $con, $flags_ref, $stream, $data ) = @_;
50 1 return pack 'N', $data;
51 }
52  
53 13 1;
« HTTP2/Frame/Data.pm ↑ Summary HTTP2/Frame.pm »