mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-12-01 04:38:35 -05:00
fix: unmap the old shared memory when zm_rtsp_server reconnects to a restarted zmc refs #5886
This commit is contained in:
1 parent
697aa897be
commit
c14f77b309
1 file changed
+8
-2
@@ -455,9 +455,15 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (stream.HasClients()) {
|
||||
// The shm connection is only needed for viewer accounting now
|
||||
if (monitor->ShmValid() or monitor->connect()) {
|
||||
monitor->setLastViewed(std::chrono::system_clock::now());
|
||||
if (!monitor->ShmValid()) {
|
||||
// zmc restarted: unmap its old shared memory instead of leaking it
|
||||
monitor->disconnect();
|
||||
if (!monitor->connect()) {
|
||||
Debug(1, "Monitor %d shared memory not available yet, retrying next pass", monitor->Id());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
monitor->setLastViewed(std::chrono::system_clock::now());
|
||||
}
|
||||
} // end foreach monitor
|
||||
|
||||
|
||||
Reference in new issue
Block a user