]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/smux.cpp
Initializing constructor added for IA_USER
[stg.git] / projects / stargazer / plugins / other / smux / smux.cpp
index fc45fe04e2d15fc93558ba602f8e505e529b0240..8faccc2d3ed8de0fee1abd2c82beba906ae527d5 100644 (file)
@@ -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<SMUX *>(d);