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,11 +166,7 @@ while (!$zm_terminate) {
foreach my $connection ( values(%spawned_connections) ) { foreach my $connection ( values(%spawned_connections) ) {
if ( vec($rout, $connection->fileno(), 1) ) { if ( vec($rout, $connection->fileno(), 1) ) {
Debug('Got input from spawned connection ' Debug('Got input from spawned connection '
.$connection->name() .$connection->name().' ('.$connection->fileno().')');
.' ('
.$connection->fileno()
.')'
);
my $messages = $connection->getMessages(); my $messages = $connection->getMessages();
if (defined($messages)) { if (defined($messages)) {
foreach my $message ( @$messages ) { foreach my $message ( @$messages ) {
@ -200,15 +196,17 @@ while (!$zm_terminate) {
foreach my $connection ( @in_poll_connections ) { foreach my $connection ( @in_poll_connections ) {
my $messages = $connection->getMessages(); my $messages = $connection->getMessages();
if (defined($messages)) { if (defined($messages)) {
foreach my $message ( @$messages ) { foreach my $message (@$messages) handleMessage($connection, $message);
handleMessage($connection, $message);
}
} }
} }
# Check for alarms that might have happened # Check for alarms that might have happened
my @out_messages; my @out_messages;
foreach my $monitor ( values %monitors ) { 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. # Our attempt to verify the memory handle failed. We should reload the monitors.
@ -217,15 +215,11 @@ while (!$zm_terminate) {
next; next;
} }
my ( $state, $last_event ) = zmMemRead( $monitor, my ($state, $last_event) = zmMemRead($monitor, [
[
'shared_data:state', 'shared_data:state',
'shared_data:last_event' '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 # In alarm state
if ( !defined($monitor->{LastEvent}) if ( !defined($monitor->{LastEvent})