zmMemVerify attaches, so we need to zmMemInvalidate even if the shared data is no good

This commit is contained in:
Isaac Connor 2017-01-10 15:09:30 -05:00
parent a146d7bee1
commit 7ddd5359d0
1 changed files with 7 additions and 8 deletions

View File

@ -117,7 +117,7 @@ use bytes;
# ==========================================================================
use constant MAX_CONNECT_DELAY => 10;
use constant MONITOR_RELOAD_INTERVAL => 30;
use constant MONITOR_RELOAD_INTERVAL => 300;
use constant SELECT_TIMEOUT => 0.25;
# ==========================================================================
@ -334,7 +334,7 @@ while( 1 )
]
);
print( "$monitor->{Id}: S:$state, LE:$last_event\n" );
#print( "$monitor->{Id}: S:$state, LE:$last_event\n" );
#print( "$monitor->{Id}: mS:$monitor->{LastState}, mLE:$monitor->{LastEvent}\n" );
if ( $state == STATE_ALARM
|| $state == STATE_ALERT
@ -429,10 +429,8 @@ while( 1 )
# If necessary reload monitors
if ( $needsReload || ((time() - $monitor_reload_time) > MONITOR_RELOAD_INTERVAL ))
{
print "TIme to reload Monitors " . join(',',keys %monitors ). "\n";
foreach my $monitor ( values(%monitors) )
{
print "imvalidating $$monitor{Id}\n";
# Free up any used memory handle
zmMemInvalidate( $monitor );
}
@ -460,10 +458,11 @@ sub loadMonitors
or Fatal( "Can't execute: ".$sth->errstr() );
while( my $monitor = $sth->fetchrow_hashref() )
{
next
if ( !zmMemVerify( $monitor ) ) {
; # Check shared memory ok
}
# Check shared memory ok
if ( !zmMemVerify( $monitor ) ) {
zmMemInvalidate( $monitor );
next;
}
if ( defined($monitors{$monitor->{Id}}->{LastState}) )
{