add a test for valid in the shared data. zmc sets this to false when it closes properly

This commit is contained in:
Isaac Connor 2017-01-10 15:08:49 -05:00
parent faeb785961
commit a146d7bee1
1 changed files with 7 additions and 3 deletions

View File

@ -246,12 +246,10 @@ sub zmMemInit {
sub zmMemVerify {
my $monitor = shift;
if ( !zmMemAttach( $monitor, $mem_size ) ) {
print "no attach for $$monitor{Id} $mem_size\n";
return( undef );
}
my $mem_key = zmMemKey( $monitor );
print "mem_key for $$monitor{Id} $mem_key\n";
if ( !defined($mem_verified->{$mem_key}) ) {
my $sd_size = zmMemRead( $monitor, "shared_data:size", 1 );
if ( $sd_size != $mem_data->{shared_data}->{size} ) {
@ -294,6 +292,13 @@ print "mem_key for $$monitor{Id} $mem_key\n";
}
return( undef );
}
if ( !zmMemRead($monitor, "shared_data:valid",1) ) {
Error( "Shared data not valid for monitor $$monitor{Id}" );
return( undef );
} else {
Debug( "Shared data valid for monitor $$monitor{Id}" );
}
$mem_verified->{$mem_key} = !undef;
}
return( !undef );
@ -367,7 +372,6 @@ sub zmMemRead {
sub zmMemInvalidate {
my $monitor = shift;
my $mem_key = zmMemKey($monitor);
print "zmMemInvalidate $$monitor{Id} $mem_key\n";
if ( $mem_key ) {
delete $mem_verified->{$mem_key};
zmMemDetach( $monitor );