diff --git a/util/perl/TLSProxy/Proxy.pm b/util/perl/TLSProxy/Proxy.pm index 6bc98f233df7ca..32fa64a6f712ea 100644 --- a/util/perl/TLSProxy/Proxy.pm +++ b/util/perl/TLSProxy/Proxy.pm @@ -114,7 +114,7 @@ sub init isdtls => $isdtls, proxy_port => 0, client_port => 49152 + int(rand(65535 - 49152)), - server_port => 0, + server_port => 49152 + int(rand(65535 - 49152)), serverpid => 0, clientpid => 0, execute => $execute, @@ -266,7 +266,7 @@ sub start #generation. Using "-ext_cache" replaces the default callback with a #different one that doesn't get confused. ." -ext_cache" - ." -accept $self->{server_addr}:0" + ." -accept $self->{server_addr}:$self->{server_port}" ." -cert ".$self->cert." -cert2 ".$self->cert ." -naccept ".$self->serverconnects; if ($self->{isdtls}) { @@ -301,8 +301,7 @@ sub start while (<>) { print; s/\R$//; # Better chomp - next unless (/^ACCEPT\s.*:(\d+)$/); - $self->{server_port} = $1; + next unless (/^ACCEPT$/); last; } @@ -472,7 +471,7 @@ sub clientstart if ($server_sock->sysread($indata, 16384)) { if ($indata = $self->process_packet(1, $indata)) { print "client_sock->syswrite\n"; - if($client_sock->syswrite($indata) == undef) { + if(!$client_sock->syswrite($indata)) { $printerrno = 1; goto END; } @@ -488,7 +487,7 @@ sub clientstart if ($client_sock->sysread($indata, 16384)) { if ($indata = $self->process_packet(0, $indata)) { print "server_sock->syswrite\n"; - if($server_sock->syswrite($indata) == undef) { + if(!$server_sock->syswrite($indata)) { $printerrno = 1; goto END; }