| 1 | package IO::Socket::Forwarder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | our @EXPORT_OK = qw(forward_sockets); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use constant _default_io_buffer_size => 64 * 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use constant _default_io_chunk_size => 16 * 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub _debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | require Time::HiRes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $time = Time::HiRes::time(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my @date = localtime $time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $out = "@_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $out =~ s/([^ -~])/sprintf("\\x%02x", ord $1)/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | warn sprintf("%02d:%02d:%02d.%03d: %s\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | @date[2, 1, 0], 1000 * ($time - int $time), $out); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # lazy accessors to IO::Socket::SSL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # we use it but don't depend on it! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub _ssl_error { $IO::Socket::SSL::SSL_ERROR } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ssl_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub _ssl_want_read { IO::Socket::SSL::SSL_WANT_READ() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ssl_want_read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub _ssl_want_write { IO::Socket::SSL::SSL_WANT_WRITE() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ssl_want_write: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub _min { $_[0] < $_[1] ? $_[0] : $_[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_min: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub forward_sockets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
forward_sockets: not called CC=139 SCAR=98.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my ($s1, $s2, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $debug = delete $opts{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $debug = $IO::Socket::Forwarder::debug unless defined $debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $io_buffer_size = delete $opts{io_buffer_size} || _default_io_buffer_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $opts{'io_buffer_size'} || 65536
MC/DC0%0/1
delete $opts{'io_buffer_size'} || 65536
delete $opts{'io_buffer_size'}
Truth table0%0/2
A
A= delete $opts{'io_buffer_size'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $io_chunk_size = delete $opts{io_chunk_size} || _default_io_chunk_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $opts{'io_chunk_size'} || 16384
MC/DC0%0/1
delete $opts{'io_chunk_size'} || 16384
delete $opts{'io_chunk_size'}
Truth table0%0/2
A
A= delete $opts{'io_chunk_size'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $fn1 = fileno $s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | defined $fn1 or croak "socket 1 is not a valid file handle"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $fn2 = fileno $s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | defined $fn1 or croak "socket 2 is not a valid file handle"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $ssl1 = $s1->isa('IO::Socket::SSL'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $ssl2 = $s2->isa('IO::Socket::SSL'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $debug and _debug "s1 fn=$fn1, ssl=$ssl1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $debug and _debug "s2 fn=$fn2, ssl=$ssl2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $b1to2 = delete $opts{buffer_1to2} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $opts{"buffer_1to2"} // ""
MC/DC0%0/1
delete $opts{"buffer_1to2"} // ""
delete $opts{"buffer_1to2"}
Truth table0%0/2
A
A= delete $opts{"buffer_1to2"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my $b2to1 = delete $opts{buffer_2to1} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $opts{"buffer_2to1"} // ""
MC/DC0%0/1
delete $opts{"buffer_2to1"} // ""
delete $opts{"buffer_2to1"}
Truth table0%0/2
A
A= delete $opts{"buffer_2to1"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ($debug) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | _debug "b1to2: $b1to2"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | _debug "b2to1: $b2to1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my ($write_chunk_size1, $write_chunk_size2) = ($io_chunk_size, $io_chunk_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my ($s1_in_closed, $s2_in_closed, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $s1_out_closed, $s2_out_closed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $ssl_wtr1, $ssl_wtw1, $ssl_wtr2, $ssl_wtw2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | %close); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | unless ($^O =~ /Win32/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | fcntl($s1, F_SETFL, fcntl($s1, F_GETFL, 0) | O_NONBLOCK) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | or croak "unable to make socket 1 non-blocking"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | fcntl($s2, F_SETFL, fcntl($s2, F_GETFL, 0) | O_NONBLOCK) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | or croak "unable to make socket 2 non-blocking"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | if (0 and $debug) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | _debug "delaying..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | sleep 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | _debug "starting..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $wtr1 = (not $s1_in_closed and length $b1to2 < $io_buffer_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$s1_in_closed && length $b1to2 < $io_buffer_size
MC/DC0%0/2
!$s1_in_closed && length $b1to2 < $io_buffer_size
!$s1_in_closed
length $b1to2 < $io_buffer_size
Truth table0%0/3
not(A) && B
A= !$s1_in_closedB= length $b1to2 < $io_buffer_size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ($ssl1 and $wtr1 and $s1->pending) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ssl1 and $wtr1 and $s1->pending
$ssl1 and $wtr1
MC/DC0%0/3
$ssl1 and $wtr1 and $s1->pending
$ssl1
$wtr1
$s1->pending
Truth table0%0/4
A and B and C
A= $ssl1B= $wtr1C= $s1->pending
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sysread($s1, $b1to2, _min($s1->pending, $io_buffer_size), length $b1to2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | and redo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $wtr2 = (not $s2_in_closed and length $b2to1 < $io_buffer_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$s2_in_closed && length $b2to1 < $io_buffer_size
MC/DC0%0/2
!$s2_in_closed && length $b2to1 < $io_buffer_size
!$s2_in_closed
length $b2to1 < $io_buffer_size
Truth table0%0/3
not(A) && B
A= !$s2_in_closedB= length $b2to1 < $io_buffer_size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ($ssl2 and $wtr2 and $s2->pending) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ssl2 and $wtr2 and $s2->pending
$ssl2 and $wtr2
MC/DC0%0/3
$ssl2 and $wtr2 and $s2->pending
$ssl2
$wtr2
$s2->pending
Truth table0%0/4
A and B and C
A= $ssl2B= $wtr2C= $s2->pending
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sysread($s2, $b2to1, _min($s2->pending, $io_buffer_size), length $b2to1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | and redo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $wtw1 = (not $s1_out_closed and length $b2to1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$s1_out_closed && length $b2to1
MC/DC0%0/2
!$s1_out_closed && length $b2to1
!$s1_out_closed
length $b2to1
Truth table0%0/3
not(A) && B
A= !$s1_out_closedB= length $b2to1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $wtw2 = (not $s2_out_closed and length $b1to2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$s2_out_closed && length $b1to2
MC/DC0%0/2
!$s2_out_closed && length $b1to2
!$s2_out_closed
length $b1to2
Truth table0%0/3
not(A) && B
A= !$s2_out_closedB= length $b1to2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $debug and _debug "wtr1: $wtr1, wtr2: $wtr2, wtw1: $wtw1, wtw2: $wtw2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | unless ($wtr1 or $wtr2 or $wtw1 or $wtw2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$wtr1 or $wtr2 or $wtw1 or $wtw2
$wtr1 or $wtr2 or $wtw1
$wtr1 or $wtr2
MC/DC0%0/4
$wtr1 or $wtr2 or $wtw1 or $wtw2
$wtr1
$wtr2
$wtw1
$wtw2
Truth table0%0/5
A or B or C or D
A= $wtr1B= $wtr2C= $wtw1D= $wtw2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | $debug and _debug "nothing else to do, exiting..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $bitsr = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | vec($bitsr, $fn1, 1) = 1 if (($wtr1 && !$ssl_wtw1) || $ssl_wtr1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$wtr1 and not $ssl_wtw1 or $ssl_wtr1
$wtr1 and not $ssl_wtw1
MC/DC0%0/3
$wtr1 and not $ssl_wtw1 or $ssl_wtr1
$wtr1
not $ssl_wtw1
$ssl_wtr1
Truth table0%0/5
A and not(B) or C
A= $wtr1B= not $ssl_wtw1C= $ssl_wtr1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | vec($bitsr, $fn2, 1) = 1 if (($wtr2 && !$ssl_wtw2) || $ssl_wtr2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$wtr2 and not $ssl_wtw2 or $ssl_wtr2
$wtr2 and not $ssl_wtw2
MC/DC0%0/3
$wtr2 and not $ssl_wtw2 or $ssl_wtr2
$wtr2
not $ssl_wtw2
$ssl_wtr2
Truth table0%0/5
A and not(B) or C
A= $wtr2B= not $ssl_wtw2C= $ssl_wtr2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $bitsw = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | vec($bitsw, $fn1, 1) = 1 if (($wtw1 && !$ssl_wtr1) || $ssl_wtw1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$wtw1 and not $ssl_wtr1 or $ssl_wtw1
$wtw1 and not $ssl_wtr1
MC/DC0%0/3
$wtw1 and not $ssl_wtr1 or $ssl_wtw1
$wtw1
not $ssl_wtr1
$ssl_wtw1
Truth table0%0/5
A and not(B) or C
A= $wtw1B= not $ssl_wtr1C= $ssl_wtw1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | vec($bitsw, $fn2, 1) = 1 if (($wtw2 && !$ssl_wtr2) || $ssl_wtw2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$wtw2 and not $ssl_wtr2 or $ssl_wtw2
$wtw2 and not $ssl_wtr2
MC/DC0%0/3
$wtw2 and not $ssl_wtr2 or $ssl_wtw2
$wtw2
not $ssl_wtr2
$ssl_wtw2
Truth table0%0/5
A and not(B) or C
A= $wtw2B= not $ssl_wtr2C= $ssl_wtw2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $debug and _debug "calling select('$bitsr', '$bitsw')..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $n = select($bitsr, $bitsw, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | $debug and _debug "select done, n: $n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if ($n > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ($wtr1 and vec(($ssl_wtw1 ? $bitsw : $bitsr), $fn1, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$wtr1 and vec $ssl_wtw1 ? $bitsw : $bitsr, $fn1, 1
MC/DC0%0/2
$wtr1 and vec $ssl_wtw1 ? $bitsw : $bitsr, $fn1, 1
$wtr1
vec $ssl_wtw1 ? $bitsw : $bitsr, $fn1, 1
Truth table0%0/3
A and B
A= $wtr1B= vec $ssl_wtw1 ? $bitsw : $bitsr, $fn1, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | $debug and _debug "reading from s1..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $bytes = sysread($s1, $b1to2, $io_chunk_size, length $b1to2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $debug and _debug "bytes: " . ($bytes // '<undef>'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$bytes // "<undef>"
MC/DC0%0/1
$bytes // "<undef>"
$bytes
Truth table0%0/2
A
A= $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ($bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | undef $ssl_wtw1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | $debug and _debug "s1 read: " . substr($b1to2, -$bytes); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ▶ | elsif ($ssl1 and not defined $bytes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ssl1 and not defined $bytes
MC/DC0%0/2
$ssl1 and not defined $bytes
$ssl1
not defined $bytes
Truth table0%0/3
A and not(B)
A= $ssl1B= not defined $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (_ssl_error == _ssl_want_write) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $ssl_wtw1 = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $debug and _debug "s1 wants to write for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | elsif (_ssl_error == _ssl_want_read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | $debug and _debug "s1 wants to read more for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | _debug "unexpected SSL error " . _ssl_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $close{slin} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | elsif ($ssl_wtw1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | undef $ssl_wtw1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $debug and _debug "nothing read from s1, closing schedulled"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $close{s1in} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ($wtr2 and vec(($ssl_wtw2 ? $bitsw : $bitsr), $fn2, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$wtr2 and vec $ssl_wtw2 ? $bitsw : $bitsr, $fn2, 1
MC/DC0%0/2
$wtr2 and vec $ssl_wtw2 ? $bitsw : $bitsr, $fn2, 1
$wtr2
vec $ssl_wtw2 ? $bitsw : $bitsr, $fn2, 1
Truth table0%0/3
A and B
A= $wtr2B= vec $ssl_wtw2 ? $bitsw : $bitsr, $fn2, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | $debug and _debug "reading from s2..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $bytes = sysread($s2, $b2to1, $io_chunk_size, length $b2to1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | $debug and _debug "bytes: " . ($bytes // '<undef>'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$bytes // "<undef>"
MC/DC0%0/1
$bytes // "<undef>"
$bytes
Truth table0%0/2
A
A= $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if ($bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | undef $ssl_wtw2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $debug and _debug "s2 read: " . substr($b2to1, -$bytes); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ▶ | elsif ($ssl2 and not defined $bytes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ssl2 and not defined $bytes
MC/DC0%0/2
$ssl2 and not defined $bytes
$ssl2
not defined $bytes
Truth table0%0/3
A and not(B)
A= $ssl2B= not defined $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if (_ssl_error == _ssl_want_write) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $ssl_wtw2 = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | $debug and _debug "s2 wants to write for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | elsif (_ssl_error == _ssl_want_read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $debug and _debug "s2 wants to read more for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | _debug "unexpected SSL error " . _ssl_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | elsif ($ssl_wtw2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | undef $ssl_wtw2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | $debug and _debug "nothing read from s2, closing schedulled"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $close{s2in} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ($wtw1 and vec(($ssl_wtr1 ? $bitsr : $bitsw), $fn1, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$wtw1 and vec $ssl_wtr1 ? $bitsr : $bitsw, $fn1, 1
MC/DC0%0/2
$wtw1 and vec $ssl_wtr1 ? $bitsr : $bitsw, $fn1, 1
$wtw1
vec $ssl_wtr1 ? $bitsr : $bitsw, $fn1, 1
Truth table0%0/3
A and B
A= $wtw1B= vec $ssl_wtr1 ? $bitsr : $bitsw, $fn1, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $debug and _debug "writting to s1..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $bytes = syswrite($s1, $b2to1, $io_chunk_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $debug and _debug "bytes: " . ($bytes // '<undef>'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$bytes // "<undef>"
MC/DC0%0/1
$bytes // "<undef>"
$bytes
Truth table0%0/2
A
A= $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | if ($bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $debug and _debug "s1 wrote: " . substr($b2to1, 0, $bytes); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | substr($b2to1, 0, $bytes, ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if ($s2_in_closed and !length $b2to1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s2_in_closed and not length $b2to1
MC/DC0%0/2
$s2_in_closed and not length $b2to1
$s2_in_closed
not length $b2to1
Truth table0%0/3
A and not(B)
A= $s2_in_closedB= not length $b2to1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | $debug and _debug "buffer exhausted and s2-in is closed, shutting down s1-out"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | shutdown($s1, 1) unless $ssl1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $s1_out_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $write_chunk_size1 = $io_chunk_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | undef $ssl_wtr1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ▶ | elsif ($ssl1 and not defined $bytes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ssl1 and not defined $bytes
MC/DC0%0/2
$ssl1 and not defined $bytes
$ssl1
not defined $bytes
Truth table0%0/3
A and not(B)
A= $ssl1B= not defined $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if (_ssl_error == _ssl_want_read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $ssl_wtr1 = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $debug and _debug "s1 wants to read for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | elsif (_ssl_error == _ssl_want_write) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $write_chunk_size1 = length $b2to1 if length $b2to1 < $write_chunk_size1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $debug and _debug "s1 wants to write more for SSL, wcs1: $write_chunk_size1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | _debug "unexpected SSL error " . _ssl_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $close{s1out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | $debug and _debug "nothing written to s1, closing schedulled"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $close{s1out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if ($wtw2 and vec(($ssl_wtr2 ? $bitsr : $bitsw), $fn2, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$wtw2 and vec $ssl_wtr2 ? $bitsr : $bitsw, $fn2, 1
MC/DC0%0/2
$wtw2 and vec $ssl_wtr2 ? $bitsr : $bitsw, $fn2, 1
$wtw2
vec $ssl_wtr2 ? $bitsr : $bitsw, $fn2, 1
Truth table0%0/3
A and B
A= $wtw2B= vec $ssl_wtr2 ? $bitsr : $bitsw, $fn2, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | $debug and _debug "writting to s2..."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $bytes = syswrite($s2, $b1to2, $write_chunk_size2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $debug and _debug "bytes: " . ($bytes // '<undef>'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$bytes // "<undef>"
MC/DC0%0/1
$bytes // "<undef>"
$bytes
Truth table0%0/2
A
A= $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if ($bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $debug and _debug "s2 wrote: " . substr($b1to2, 0, $bytes); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | substr($b1to2, 0, $bytes, ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if ($s1_in_closed and length $b1to2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s1_in_closed and length $b1to2
MC/DC0%0/2
$s1_in_closed and length $b1to2
$s1_in_closed
length $b1to2
Truth table0%0/3
A and B
A= $s1_in_closedB= length $b1to2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | $debug and _debug "buffer exhausted and s2-in is closed, shutting down s1-out"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | shutdown($s2, 1) unless $ssl2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $s2_out_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $write_chunk_size2 = $io_chunk_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | undef $ssl_wtr2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ▶ | elsif ($ssl2 and not defined $bytes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ssl2 and not defined $bytes
MC/DC0%0/2
$ssl2 and not defined $bytes
$ssl2
not defined $bytes
Truth table0%0/3
A and not(B)
A= $ssl2B= not defined $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if (_ssl_error == _ssl_want_read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $ssl_wtr2 = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $debug and _debug "s2 wants to read for SSL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | elsif (_ssl_error == _ssl_want_write) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | $write_chunk_size2 = length $b1to2 if length $b1to2 < $write_chunk_size2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | $debug and _debug "s2 wants to write more for SSL, wcs2: $write_chunk_size2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | _debug "unexpected SSL error " . _ssl_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $close{s2out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | $debug and _debug "nothing written to s1, closing schedulled"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $close{s2out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if (%close) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | for (1, 2, 3) { # propagate close flag to dependants | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ($ssl1 and ($close{s1in} or $close{s1out})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ssl1 and $close{"s1in"} || $close{"s1out"}
$close{"s1in"} or $close{"s1out"}
MC/DC0%0/3
$ssl1 and $close{"s1in"} || $close{"s1out"}
$ssl1
$close{"s1in"}
$close{"s1out"}
Truth table0%0/4
A and B or C
A= $ssl1B= $close{"s1in"}C= $close{"s1out"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $close{s1in} = $close{s1out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | if ($ssl2 and ($close{s2in} or $close{s2out})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ssl2 and $close{"s2in"} || $close{"s2out"}
$close{"s2in"} or $close{"s2out"}
MC/DC0%0/3
$ssl2 and $close{"s2in"} || $close{"s2out"}
$ssl2
$close{"s2in"}
$close{"s2out"}
Truth table0%0/4
A and B or C
A= $ssl2B= $close{"s2in"}C= $close{"s2out"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $close{s2in} = $close{s2out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if ($close{s1in} and !length $b1to2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$close{"s1in"} and not length $b1to2
MC/DC0%0/2
$close{"s1in"} and not length $b1to2
$close{"s1in"}
not length $b1to2
Truth table0%0/3
A and not(B)
A= $close{"s1in"}B= not length $b1to2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $close{s2out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if ($close{s2in} and !length $b2to1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$close{"s2in"} and not length $b2to1
MC/DC0%0/2
$close{"s2in"} and not length $b2to1
$close{"s2in"}
not length $b2to1
Truth table0%0/3
A and not(B)
A= $close{"s2in"}B= not length $b2to1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $close{s1out} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if ($close{s1in}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | $debug and _debug "shutdown s1 in"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | shutdown($s1, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $s1_in_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if ($close{s2in}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | $debug and _debug "shutdown s2 in"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | shutdown($s2, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $s2_in_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if ($close{s1out}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $debug and _debug "shutdown s1 out"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | shutdown($s1, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $s1_out_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ($close{s2out}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | $debug and _debug "shutdown s1 out"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | shutdown($s2, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $s2_out_closed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | %close = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | shutdown($s1, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | shutdown($s2, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||