X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/44378b3654976b893daa96f44cea9fcb62092209..a73c885317f58a03bc78ed6ceedd5067dd79a750:/projects/stargazer/plugins/other/smux/smux.cpp diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index fc45fe04..fdcaaf02 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -209,8 +209,6 @@ int SMUX::Stop() printfd(__FILE__, "SMUX::Stop() - Before\n"); running = false; -ResetNotifiers(); - if (!stopped) { //5 seconds to thread stops itself @@ -236,12 +234,37 @@ if (!stopped) pthread_join(thread, NULL); +ResetNotifiers(); + + { + Tables::iterator it; + for (it = tables.begin(); it != tables.end(); ++it) + delete it->second; + } + { + Sensors::iterator it; + for (it = sensors.begin(); it != sensors.end(); ++it) + delete it->second; + } + +tables.erase(tables.begin(), tables.end()); +sensors.erase(sensors.begin(), sensors.end()); + close(sock); printfd(__FILE__, "SMUX::Stop() - After\n"); return 0; } +int SMUX::Reload() +{ +if (Stop()) + return -1; +if (Start()) + return -1; +return 0; +} + void * SMUX::Runner(void * d) { SMUX * smux = static_cast(d); @@ -253,8 +276,11 @@ return NULL; void SMUX::Run() { -SendOpenPDU(sock); -SendRReqPDU(sock); +stopped = true; +if (!SendOpenPDU(sock)) + return; +if (!SendRReqPDU(sock)) + return; running = true; stopped = false;