When connecting to a monitor, if it fails, disconnect. This should fix a bug in zmtrigger and others where it would never reconnect. The idea is that we asked for a successful connection, if it failed, we shouldn't be in a failed connected state, we should be disconnected.

This commit is contained in:
Isaac Connor 2022-03-08 09:06:06 -05:00
parent 8fe0cb5e33
commit a748b0ed0a
1 changed files with 6 additions and 1 deletions

View File

@ -298,11 +298,16 @@ sub Event_Summary {
sub connect {
my $self = shift;
return ZoneMinder::Memory::zmMemVerify($self);
ZoneMinder::Logger::Debug(4, "Connecting");
if (!ZoneMinder::Memory::zmMemVerify($self)) {
$self->disconnect();
}
return !undef;
}
sub disconnect {
my $self = shift;
ZoneMinder::Logger::Debug(4, "Disconnecting");
ZoneMinder::Memory::zmMemInvalidate($self); # Close our file handle to the zmc process we are about to end
}