From 02f6c6999d1a4ce19454a587007c918c0861eb75 Mon Sep 17 00:00:00 2001 From: yrutschle Date: Sun, 18 Apr 2021 11:18:26 +0200 Subject: [PATCH] fix client/server protocol to indicate process death, and make process mortal again --- t_load | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/t_load b/t_load index ff2a0ee..e375f05 100755 --- a/t_load +++ b/t_load @@ -27,7 +27,7 @@ my $NUM_CNX = 30; # you start 200 processes in under a second, things go wrong # and it's not sslh's fault (typically the echosrv won't be # forking fast enough). -my $start_time_delay = 1; +my $start_time_delay = .1; # If you test 4 protocols, you'll start $NUM_CNX * 4 clients # (e.g. 40), starting one every $start_time_delay seconds. @@ -118,7 +118,10 @@ sub client { $error = "M" if $r ne $expected; print $fd_out ("$client_id\t$r_l\t$error\n"); ($? = 1, die "$service got [$r] expected [$expected]\n") if ($r ne $expected); - #last if rand(1) < $stop_client_probability; + if (rand(1) < $stop_client_probability) { + print $fd_out ("$client_id\t$r_l\tD\n"); + last; + } $cnt++; } } @@ -128,7 +131,7 @@ sub client { foreach my $p (keys %protocols) { if (!fork) { my $cmd = "./echosrv --listen $protocols{$p}->{address} --prefix '$p: '"; - print "$cmd\n"; + warn "$cmd\n"; exec $cmd; } } @@ -140,7 +143,7 @@ if (!($sslh_pid = fork)) { my $user = (getpwuid $<)[0]; # Run under current username my $prots = join " ", map "--$_ $protocols{$_}->{address}", keys %protocols; my $cmd = "$sslh_binary -f -v3 -t 3 -u $user --listen $sslh_address $prots -P $pidfile"; - print "$cmd\n"; + warn "$cmd\n"; exec $cmd; exit 0; } @@ -175,7 +178,8 @@ if (!fork) { my ($client_id, $r_l, $error, @rest) = split /\t/, $_; my ($curr_rcv) = ${$data{$client_id}}[0]; - my ($curr_error) = ${$data{$client_id}}[1]; + my ($curr_error) = ${$data{$client_id}}[1] // ""; + $error //= ""; $data{$client_id} = [ $r_l + $curr_rcv, "$curr_error$error" ]; print "\033[0;0H";