line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP2::Client::ConnectionPool; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Net::HTTP2::Constants (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
193
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
0
|
2
|
my ($class, $io_name, $conn_opts_hr) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
3
|
my $ns = "Net::HTTP2::Client::Connection::$io_name"; |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
|
|
|
8
|
if (!$ns->can('new')) { |
16
|
1
|
|
|
|
|
2
|
local $@; |
17
|
1
|
50
|
|
|
|
42
|
Carp::croak $@ if !eval "require $ns"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
14
|
return bless { |
21
|
|
|
|
|
|
|
conn_ns => $ns, |
22
|
|
|
|
|
|
|
conn_opts => $conn_opts_hr, |
23
|
|
|
|
|
|
|
}, $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_connection { |
27
|
2
|
|
|
2
|
0
|
4
|
my ($self, $host, $port) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $self->{'pool'}{$host}{$port || q<>} ||= $self->{'conn_ns'}->new( |
30
|
|
|
|
|
|
|
$host, |
31
|
2
|
50
|
50
|
|
|
15
|
%{ $self->{'conn_opts'} }, |
|
2
|
|
33
|
|
|
23
|
|
32
|
|
|
|
|
|
|
($port == Net::HTTP2::Constants::HTTPS_PORT ? () : (port => $port)), |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |