mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 07:37:15 +03:00
fix client/server protocol to indicate process death, and make process mortal again
This commit is contained in:
parent
41a914b350
commit
02f6c6999d
14
t_load
14
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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user