diff options
author | Andy Polyakov <appro@openssl.org> | 2018-04-12 10:05:22 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2018-04-14 20:00:04 +0200 |
commit | 4442061532fb1a98c22609bf37303b77716df624 (patch) | |
tree | 518f1d3cf6bc60541fa5488fc04883ab0a8aa7b7 /util | |
parent | de5b3a8645a3b2dd22fa8866e64488eb2b69777d (diff) |
TLSProxy/Proxy.pm: straighten inner loop termination logic.
Original condition was susceptible to race condition...
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5933)
Diffstat (limited to 'util')
-rw-r--r-- | util/perl/TLSProxy/Proxy.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/util/perl/TLSProxy/Proxy.pm b/util/perl/TLSProxy/Proxy.pm index ea2c7a689e..9e9764d401 100644 --- a/util/perl/TLSProxy/Proxy.pm +++ b/util/perl/TLSProxy/Proxy.pm @@ -369,12 +369,14 @@ sub clientstart $fdset = IO::Select->new($server_sock, $client_sock); my @ready; my $ctr = 0; + my $sessionfile = $self->{sessionfile}; local $SIG{PIPE} = "IGNORE"; - while($fdset->count - && (!(TLSProxy::Message->end) - || (defined $self->sessionfile() - && (-s $self->sessionfile()) == 0)) - && $ctr < 10) { + while($fdset->count && $ctr < 10) { + if (defined($sessionfile)) { + # s_client got -ign_eof and won't be exiting voluntarily, so we + # look for data *and* check on session file... + last if TLSProxy::Message->success() && -s $sessionfile; + } if (!(@ready = $fdset->can_read(1))) { $ctr++; next; |