]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/authorization/stress/stress.cpp
Added assignment operator for SGCONF::OPTION.
[stg.git] / projects / stargazer / plugins / authorization / stress / stress.cpp
index 756e6e1a5e79ab924a79d1c03110fa98f11d1dea..39e74b0d44a18c653030857787ed26907a435021 100644 (file)
 #include "stg/user.h"
 #include "stg/common.h"
 #include "stg/user_property.h"
 #include "stg/user.h"
 #include "stg/common.h"
 #include "stg/user_property.h"
+#include "stg/plugin_creator.h"
 
 #include "stress.h"
 
 
 #include "stress.h"
 
-class STRESS_CREATOR
-{
-private:
-    AUTH_STRESS * dc;
-
-public:
-    STRESS_CREATOR()
-        {
-        printfd(__FILE__, "constructor STRESS_CREATOR\n");
-        dc = new AUTH_STRESS();
-        };
-    ~STRESS_CREATOR()
-        {
-        printfd(__FILE__, "destructor STRESS_CREATOR\n");
-        delete dc;
-        };
-
-    PLUGIN * GetPlugin()
-    {
-        return dc;
-    };
-};
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-STRESS_CREATOR stressc;
+PLUGIN_CREATOR<AUTH_STRESS> stressc;
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -91,21 +70,6 @@ AUTH_STRESS_SETTINGS::AUTH_STRESS_SETTINGS()
 {
 }
 //-----------------------------------------------------------------------------
 {
 }
 //-----------------------------------------------------------------------------
-int AUTH_STRESS_SETTINGS::ParseIntInRange(const string & str, int min, int max, int * val)
-{
-if (str2x(str.c_str(), *val))
-    {
-    errorStr = "Incorrect value \'" + str + "\'.";
-    return -1;
-    }
-if (*val < min || *val > max)
-    {
-    errorStr = "Value \'" + str + "\' out of range.";
-    return -1;
-    }
-return 0;
-}
-//-----------------------------------------------------------------------------
 int AUTH_STRESS_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 {
 PARAM_VALUE pv;
 int AUTH_STRESS_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 {
 PARAM_VALUE pv;
@@ -212,7 +176,8 @@ if (isRunning)
         {
         if (!isRunning)
             break;
         {
         if (!isRunning)
             break;
-        usleep(200000);
+        struct timespec ts = {0, 200000000};
+        nanosleep(&ts, NULL);
         }
 
     //after 5 seconds waiting thread still running. now killing it
         }
 
     //after 5 seconds waiting thread still running. now killing it
@@ -240,12 +205,12 @@ return isRunning;
 //-----------------------------------------------------------------------------
 uint16_t AUTH_STRESS::GetStartPosition() const
 {
 //-----------------------------------------------------------------------------
 uint16_t AUTH_STRESS::GetStartPosition() const
 {
-return 70;
+return 30;
 }
 //-----------------------------------------------------------------------------
 uint16_t AUTH_STRESS::GetStopPosition() const
 {
 }
 //-----------------------------------------------------------------------------
 uint16_t AUTH_STRESS::GetStopPosition() const
 {
-return 70;
+return 30;
 }
 //-----------------------------------------------------------------------------
 void AUTH_STRESS::SetUserNotifiers(USER_PTR u)
 }
 //-----------------------------------------------------------------------------
 void AUTH_STRESS::SetUserNotifiers(USER_PTR u)