[openssl-commits] [openssl] master update
Matt Caswell
matt at openssl.org
Wed Mar 15 11:27:31 UTC 2017
The branch master has been updated
via db0e0abb88b6bd5bfa5637ee84e59dcb5a232008 (commit)
from 3a80bd29be74b50771dd20e15282db693dbe9522 (commit)
- Log -----------------------------------------------------------------
commit db0e0abb88b6bd5bfa5637ee84e59dcb5a232008
Author: Matt Caswell <matt at openssl.org>
Date: Wed Mar 15 00:54:04 2017 +0000
Fix a hang in tests that use sessionfile
The logic for testing whether the sessionfile has been created or not
was faulty and could result in race conditions. If you "lose" the tests
hang waiting for a session file that's never going to arrive.
Fixes #2950
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2955)
-----------------------------------------------------------------------
Summary of changes:
util/TLSProxy/Proxy.pm | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/util/TLSProxy/Proxy.pm b/util/TLSProxy/Proxy.pm
index 189bcb8..aaef753 100644
--- a/util/TLSProxy/Proxy.pm
+++ b/util/TLSProxy/Proxy.pm
@@ -284,32 +284,30 @@ sub clientstart
#Wait for either the server socket or the client socket to become readable
my @ready;
- while(!(TLSProxy::Message->end) && (@ready = $sel->can_read)) {
+ my $ctr = 0;
+ while( (!(TLSProxy::Message->end)
+ || (defined $self->sessionfile()
+ && (-s $self->sessionfile()) == 0))
+ && $ctr < 10
+ && (@ready = $sel->can_read(1))) {
foreach my $hand (@ready) {
if ($hand == $server_sock) {
$server_sock->sysread($indata, 16384) or goto END;
$indata = $self->process_packet(1, $indata);
$client_sock->syswrite($indata);
+ $ctr = 0;
} elsif ($hand == $client_sock) {
$client_sock->sysread($indata, 16384) or goto END;
$indata = $self->process_packet(0, $indata);
$server_sock->syswrite($indata);
+ $ctr = 0;
} else {
- print "Err\n";
- goto END;
+ $ctr++
}
}
}
- for (my $ctr = 0;
- defined $self->sessionfile()
- && (!(-f $self->sessionfile()) || $ctr == 3);
- $ctr++) {
- sleep 1;
- }
-
- die "Session file not created"
- if (defined $self->sessionfile() && !(-f $self->sessionfile()));
+ die "No progress made" if $ctr >= 10;
END:
print "Connection closed\n";
More information about the openssl-commits
mailing list