From b44f14691e8cfe2776a8f91e8cd345948c32430d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 21 Nov 2020 15:08:09 -0500 Subject: [PATCH] Don't exit after 30 minutes. Google code style. --- scripts/zmcontrol.pl.in | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/zmcontrol.pl.in b/scripts/zmcontrol.pl.in index 32c1132d6..474148df3 100644 --- a/scripts/zmcontrol.pl.in +++ b/scripts/zmcontrol.pl.in @@ -162,24 +162,24 @@ if ( $options{command} ) { listen(SERVER, SOMAXCONN) or Fatal("Can't listen: $!"); my $rin = ''; - vec( $rin, fileno(SERVER), 1 ) = 1; + vec($rin, fileno(SERVER), 1) = 1; my $win = $rin; my $ein = $win; my $timeout = MAX_COMMAND_WAIT; - while( 1 ) { + while ( 1 ) { my $nfound = select(my $rout = $rin, undef, undef, $timeout); if ( $nfound > 0 ) { - if ( vec( $rout, fileno(SERVER), 1 ) ) { + if ( vec($rout, fileno(SERVER), 1) ) { my $paddr = accept(CLIENT, SERVER); my $message = ; + close(CLIENT); next if !$message; my $params = jsonDecode($message); - Debug( Dumper( $params ) ); + Debug(Dumper($params)); my $command = $params->{command}; - close(CLIENT); if ( $command eq 'quit' ) { last; } elsif ( $command ) { @@ -192,7 +192,7 @@ if ( $options{command} ) { } } elsif ( $nfound < 0 ) { if ( $! == EINTR ) { - # Likely just SIGHUP + # Likely just SIGHUP Debug("Can't select: $!"); } elsif ( $! == EPIPE ) { Error("Can't select: $!"); @@ -200,17 +200,14 @@ if ( $options{command} ) { Fatal("Can't select: $!"); } } else { - #print( "Select timed out\n" ); - last; + Debug('Select timed out'); } } # end while forever Info("Control server $id/$protocol exiting"); unlink($sock_file); $control->close(); - exit(0); } # end if !server up - exit(0); 1;