From d120523bbbdcbc2972004f1cf718e37bd599d3a4 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 16 Apr 2015 13:18:52 +0200 Subject: [PATCH] Improvements to connector shutdown code, attempted fix for Windows support. --- lib/shared_memory.cpp | 2 +- src/controller/controller_connectors.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 73c2d667..7b66edc6 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -293,7 +293,7 @@ namespace IPC { #ifdef __CYGWIN__ if (master) { //Under cygwin, all pages are 4 bytes longer than claimed. - handle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, len+4, name.c_str()); + handle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, len+4, std::string("Global\\" + name).c_str()); } else { int i = 0; do { diff --git a/src/controller/controller_connectors.cpp b/src/controller/controller_connectors.cpp index a1e8faa9..80b59c4c 100644 --- a/src/controller/controller_connectors.cpp +++ b/src/controller/controller_connectors.cpp @@ -149,8 +149,12 @@ namespace Controller { std::map::iterator it; for (it = currentConnectors.begin(); it != currentConnectors.end(); it++){ if (!runningConns.count(it->first)){ - Log("CONF", "Stopping connector " + it->first); - Util::Procs::Stop(it->second); + if (Util::Procs::isActive(it->second)){ + Log("CONF", "Stopping connector " + it->first); + Util::Procs::Stop(it->second); + } + currentConnectors.erase(it); + it = currentConnectors.begin(); } }