From ed360348efc51c4c2cb659c1e75e0790194040ee Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 10 Dec 2021 15:36:47 -0500 Subject: [PATCH] spacing, remove dead code. If Monitor Function becomes None, skip it --- scripts/zmtrigger.pl.in | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 041d1c449..49287942a 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -166,13 +166,9 @@ while (!$zm_terminate) { foreach my $connection ( values(%spawned_connections) ) { if ( vec($rout, $connection->fileno(), 1) ) { Debug('Got input from spawned connection ' - .$connection->name() - .' (' - .$connection->fileno() - .')' - ); + .$connection->name().' ('.$connection->fileno().')'); my $messages = $connection->getMessages(); - if ( defined($messages) ) { + if (defined($messages)) { foreach my $message ( @$messages ) { handleMessage($connection, $message); } @@ -199,34 +195,32 @@ while (!$zm_terminate) { # Check polled connections foreach my $connection ( @in_poll_connections ) { my $messages = $connection->getMessages(); - if ( defined($messages) ) { - foreach my $message ( @$messages ) { - handleMessage($connection, $message); - } + if (defined($messages)) { + foreach my $message (@$messages) handleMessage($connection, $message); } } # Check for alarms that might have happened my @out_messages; foreach my $monitor ( values %monitors ) { + if ($$monitor{Function} eq 'None') { + $monitor_reload_time = 0; + next; + } - if ( ! zmMemVerify($monitor) ) { + if (!zmMemVerify($monitor)) { # Our attempt to verify the memory handle failed. We should reload the monitors. # Don't need to zmMemInvalidate because the monitor reload will do it. push @needsReload, $monitor; next; } - my ( $state, $last_event ) = zmMemRead( $monitor, - [ + my ($state, $last_event) = zmMemRead($monitor, [ 'shared_data:state', 'shared_data:last_event' - ] - ); + ]); -#print( "$monitor->{Id}: S:$state, LE:$last_event" ); -#print( "$monitor->{Id}: mS:$monitor->{LastState}, mLE:$monitor->{LastEvent}" ); - if ( $state == STATE_ALARM or $state == STATE_ALERT ) { + if ($state == STATE_ALARM or $state == STATE_ALERT) { # In alarm state if ( !defined($monitor->{LastEvent}) or ($last_event != $monitor->{LastEvent})