HTTP/_HTTP2/ServerConnection.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 54 CC 5 SCAR 22.3
CC
5
Cov
0%
on_data
20.0
on_close
6.0
transaction
2.0
CRAP 9.3
1 package Linux::Event::HTTP::_HTTP2::ServerConnection;
2 use v5.36;
3 use strict;
4 use warnings;
5  
6 use parent 'Linux::Event::IO::Sock::Stream';
7  
8 our $VERSION = '0.003';
9  
10 sub on_data ($self, $bytes) {
11 my $executor = $self->{_http2_executor}
12 or die 'HTTP/2 server connection has no executor';
13  
14 my $ok = eval {
15 $executor->input($bytes);
16 1;
17 };
18 if (!$ok) {
19 my $error = "$@";
20 $error =~ s/\s+\z//;
21 $executor->close if $executor->can('close');
22 delete $self->{_http2_executor};
23 $self->close if !$self->is_closed;
24 }
25 return;
26 }
27  
28 sub on_close ($self) {
29 if (my $executor = delete $self->{_http2_executor}) {
30 $executor->close;
31 }
32 return;
33 }
34  
35 sub transaction ($self) {
36 my $executor = $self->{_http2_executor} or return undef;
37 return $executor->transaction;
38 }
39  
40 1;
41  
42 __END__