Add a warning when connecting without disconnecting which can cause memleaks

pull/3222/head
Isaac Connor 2021-04-12 13:34:50 -04:00
parent a3078d61f7
commit ab356a3695
1 changed files with 4 additions and 0 deletions

View File

@ -880,6 +880,10 @@ std::shared_ptr<Monitor> Monitor::Load(unsigned int p_id, bool load_zones, Purpo
}
bool Monitor::connect() {
if (mem_ptr != nullptr) {
Warning("Already connected. Please call disconnect first.");
}
Debug(3, "Connecting to monitor. Purpose is %d", purpose);
#if ZM_MEM_MAPPED
snprintf(mem_file, sizeof(mem_file), "%s/zm.mmap.%d", staticConfig.PATH_MAP.c_str(), id);