spacing, remove dead code. If Monitor Function becomes None, skip it

This commit is contained in:
Isaac Connor 2021-12-10 15:36:47 -05:00
parent aa320cb28f
commit ed360348ef
1 changed files with 12 additions and 18 deletions

View File

@ -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})