From 16060474339321263c1d5fa80368e858757caa5e Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Thu, 10 Mar 2016 10:07:45 +0200 Subject: [PATCH 01/16] Ticket 26. The const MODULE_SETTINGS & ms parameter added to the Reload() method of the class RADIUS in the radius.h file. --- projects/stargazer/plugins/other/radius/radius.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/radius/radius.h b/projects/stargazer/plugins/other/radius/radius.h index 8f5ba2a4..77dde0d5 100644 --- a/projects/stargazer/plugins/other/radius/radius.h +++ b/projects/stargazer/plugins/other/radius/radius.h @@ -98,7 +98,7 @@ public: int Start(); int Stop(); - int Reload() { return 0; } + int Reload(const MODULE_SETTINGS & ms) { return 0; } bool IsRunning() { return isRunning; } const std::string & GetStrError() const { return errorStr; } -- 2.44.2 From dad8dcdecb2d790427a164f365f5fd12772c0ae4 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Thu, 10 Mar 2016 10:38:49 +0200 Subject: [PATCH 02/16] Ticket 26. The const MODULE_SETTINGS & ms parameter added to the Reload() method of the class Remote_script in the rscript.h file. --- projects/stargazer/plugins/other/rscript/rscript.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index e0412fb0..0de1ea2e 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -185,7 +185,7 @@ public: int Start(); int Stop(); - int Reload(); + int Reload(const MODULE_SETTINGS & ms); bool IsRunning() { return isRunning; } const std::string & GetStrError() const { return errorStr; } -- 2.44.2 From 711da215b0294754409754bccbd920519b07c09d Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Thu, 10 Mar 2016 10:40:09 +0200 Subject: [PATCH 03/16] Ticket 26. The const MODULE_SETTINGS & ms parameter added to the int REMOTE_SCRIPT::Reload() method in the rscript.cpp file. --- projects/stargazer/plugins/other/rscript/rscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index 00114df4..27c419b8 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -301,7 +301,7 @@ if (isRunning) return 0; } //----------------------------------------------------------------------------- -int REMOTE_SCRIPT::Reload() +int REMOTE_SCRIPT::Reload(const MODULE_SETTINGS & ms) { NRMapParser nrMapParser; -- 2.44.2 From d86be1002fd2a98dd844dd2b987615613fc0c8df Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Thu, 10 Mar 2016 10:47:44 +0200 Subject: [PATCH 04/16] Ticket 26. The const MODULE_SETTINGS & ms parameter added to the Reload() method of the class SMUX in the smux.h file. --- projects/stargazer/plugins/other/smux/smux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/smux/smux.h b/projects/stargazer/plugins/other/smux/smux.h index e379ea7f..3b217eb7 100644 --- a/projects/stargazer/plugins/other/smux/smux.h +++ b/projects/stargazer/plugins/other/smux/smux.h @@ -116,7 +116,7 @@ public: int Start(); int Stop(); - int Reload(); + int Reload(const MODULE_SETTINGS & ms); bool IsRunning() { return running && !stopped; } const std::string & GetStrError() const { return errorStr; } -- 2.44.2 From 8e6fbfbd7ab27edfb62b3e30c651f67557869430 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Thu, 10 Mar 2016 10:49:25 +0200 Subject: [PATCH 05/16] Ticket 26. The const MODULE_SETTINGS & ms parameter added to the int SMUX::Reload() method in the smux.cpp file. --- projects/stargazer/plugins/other/smux/smux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/smux/smux.cpp b/projects/stargazer/plugins/other/smux/smux.cpp index 09cb4636..d1af2dbc 100644 --- a/projects/stargazer/plugins/other/smux/smux.cpp +++ b/projects/stargazer/plugins/other/smux/smux.cpp @@ -272,7 +272,7 @@ printfd(__FILE__, "SMUX::Stop() - After\n"); return 0; } -int SMUX::Reload() +int SMUX::Reload(const MODULE_SETTINGS & ms) { if (Stop()) return -1; -- 2.44.2 From e6f8d47a04848cfe9c07285282a463890daf6b6c Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Mon, 14 Mar 2016 09:49:49 +0200 Subject: [PATCH 06/16] Ticket 26. The LogProtocolErrors parameter value check and output to screen added in the AUTH_IA_SETTINGS::ParseSettings() method. --- .../stargazer/plugins/authorization/inetaccess/inetaccess.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 4456c372..23417166 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -142,6 +142,10 @@ else if (ParseYesNo(pvi->value[0], &logProtocolErrors)) printfd(__FILE__, "Cannot parse parameter 'LogProtocolErrors'\n"); return -1; } +if (logProtocolErrors) + printfd(__FILE__, "LogProtocolErrors: true\n"); +else + printfd(__FILE__, "LogProtocolErrors: false\n"); ///////////////////////////////////////////////////////////// std::string freeMbType; int n = 0; -- 2.44.2 From a29ab1ce9a9f77d794660a556d80b06d7584350d Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Mon, 14 Mar 2016 15:17:05 +0200 Subject: [PATCH 07/16] Ticket 26. Formatting fixed. --- projects/stargazer/plugin_mgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/stargazer/plugin_mgr.cpp b/projects/stargazer/plugin_mgr.cpp index b7ead90d..eec1d656 100644 --- a/projects/stargazer/plugin_mgr.cpp +++ b/projects/stargazer/plugin_mgr.cpp @@ -126,8 +126,8 @@ void PluginManager::reload(const SETTINGS_IMPL& settings) { for (size_t j = 0; j < modSettings.size(); j++) { - if (modSettings[j].moduleName == m_modules[i]->GetName()) - { + if (modSettings[j].moduleName == m_modules[i]->GetName()) + { PLUGIN & plugin = m_modules[i]->GetPlugin(); if (m_modules[i]->Reload(modSettings[j])) { @@ -136,7 +136,7 @@ void PluginManager::reload(const SETTINGS_IMPL& settings) printfd(__FILE__, "Error reloading module '%s': '%s'\n", plugin.GetVersion().c_str(), plugin.GetStrError().c_str()); } - } + } } } } -- 2.44.2 From 3a88b66f861decb863bbb00a450e2801ee668a09 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Tue, 15 Mar 2016 09:38:13 +0200 Subject: [PATCH 08/16] Ticket 26. The LogProtocolErrors parameter value check and output to screen removed in the AUTH_IA_SETTINGS::ParseSettings() method. --- .../stargazer/plugins/authorization/inetaccess/inetaccess.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 23417166..4456c372 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -142,10 +142,6 @@ else if (ParseYesNo(pvi->value[0], &logProtocolErrors)) printfd(__FILE__, "Cannot parse parameter 'LogProtocolErrors'\n"); return -1; } -if (logProtocolErrors) - printfd(__FILE__, "LogProtocolErrors: true\n"); -else - printfd(__FILE__, "LogProtocolErrors: false\n"); ///////////////////////////////////////////////////////////// std::string freeMbType; int n = 0; -- 2.44.2 From 1af107f85beb2c690fadc6d1bca7c34bfeb8705e Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Fri, 18 Mar 2016 14:40:54 +0200 Subject: [PATCH 09/16] Ticket 26. The iaSettings object is assigned the newIaSettings object values. --- .../stargazer/plugins/authorization/inetaccess/inetaccess.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 6b34618f..462c206c 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -538,6 +538,7 @@ if (newIaSettings.ParseSettings(ms)) STG_LOGGER & WriteServLog = GetStgLogger(); printfd(__FILE__, "AUTH_IA::Reload() - Reloaded InetAccess successfully.\n"); WriteServLog("AUTH_IA: Reloaded InetAccess successfully."); +iaSettings = newIaSettings; return 0; } //----------------------------------------------------------------------------- -- 2.44.2 From 2e04025761ba7c7fdd33f81f2b627c4b2ace1ef8 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Fri, 25 Mar 2016 10:28:25 +0200 Subject: [PATCH 10/16] Ticket 26. The 'return -1' removed, 'else' added for the if(newSettings.ReadSettings()). The settings = newSettings moved to 'else'. --- projects/stargazer/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index 34fc4bd0..644fed91 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -348,9 +348,11 @@ while (running) WriteServLog.SetLogFileName(newSettings.GetLogFileName()); WriteServLog("ReadSettings error. %s", newSettings.GetStrError().c_str()); - return -1; } - settings = newSettings; + else + { + settings = newSettings; + } traffCnt.Reload(); manager.reload(settings); } -- 2.44.2 From 468b7c5691bc378395915cf08ced610409c0323d Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Fri, 25 Mar 2016 15:18:47 +0200 Subject: [PATCH 11/16] Ticket 26. The STG_LOGGER & writeServLog unnecessary variable getting removed in the if(newSettings.ReadSettings) construction. --- projects/stargazer/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index 644fed91..11f4c723 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -342,8 +342,6 @@ while (running) SETTINGS_IMPL newSettings(settings); if (newSettings.ReadSettings()) { - STG_LOGGER & WriteServLog = GetStgLogger(); - if (newSettings.GetLogFileName() != "") WriteServLog.SetLogFileName(newSettings.GetLogFileName()); -- 2.44.2 From 77c22e3770e48b5ed3ca4f1d943cce2421419d2c Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Mon, 28 Mar 2016 10:04:15 +0300 Subject: [PATCH 12/16] Ticket 26. The 'break' operator added after m_modules[i]->Reload(modSettings[j])) call in the PluginManager::reload(). --- projects/stargazer/plugin_mgr.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/stargazer/plugin_mgr.cpp b/projects/stargazer/plugin_mgr.cpp index 10911b97..8d026ee6 100644 --- a/projects/stargazer/plugin_mgr.cpp +++ b/projects/stargazer/plugin_mgr.cpp @@ -121,6 +121,7 @@ void PluginManager::reload(const SETTINGS_IMPL& settings) plugin.GetStrError().c_str()); } } + break; } } } -- 2.44.2 From 3cab79a5d05e024d1b413b307c5b7a3cdddb6746 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Mon, 28 Mar 2016 10:36:47 +0300 Subject: [PATCH 13/16] Ticket 26. The WriteServLog variable replaced by logger variable. --- .../plugins/authorization/inetaccess/inetaccess.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 462c206c..99e0a091 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -529,15 +529,13 @@ int AUTH_IA::Reload(const MODULE_SETTINGS & ms) AUTH_IA_SETTINGS newIaSettings; if (newIaSettings.ParseSettings(ms)) { - STG_LOGGER & WriteServLog = GetStgLogger(); printfd(__FILE__, "AUTH_IA::Reload() - Failed to reload InetAccess.\n"); - WriteServLog("AUTH_IA: Cannot reload InetAccess. Errors found."); + logger("AUTH_IA: Cannot reload InetAccess. Errors found."); return -1; } -STG_LOGGER & WriteServLog = GetStgLogger(); printfd(__FILE__, "AUTH_IA::Reload() - Reloaded InetAccess successfully.\n"); -WriteServLog("AUTH_IA: Reloaded InetAccess successfully."); +logger("AUTH_IA: Reloaded InetAccess successfully."); iaSettings = newIaSettings; return 0; } -- 2.44.2 From 73c62ae6affac2f33430d1d1585839fafc5efdd8 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Wed, 13 Apr 2016 09:55:30 +0300 Subject: [PATCH 14/16] Ticket 26. The std::string modulePath variable definition moved after the std::string moduleName variable definition, the modSettings[i].moduleName variable replaced to moduleName when modulePath definition in the PluginManager constructor. --- projects/stargazer/plugin_mgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugin_mgr.cpp b/projects/stargazer/plugin_mgr.cpp index 8d026ee6..b127869b 100644 --- a/projects/stargazer/plugin_mgr.cpp +++ b/projects/stargazer/plugin_mgr.cpp @@ -59,8 +59,8 @@ PluginManager::PluginManager(const SETTINGS_IMPL& settings, const std::vector & modSettings(settings.GetModulesSettings()); for (size_t i = 0; i < modSettings.size(); i++) { - std::string modulePath = basePath + "/mod_" + modSettings[i].moduleName + ".so"; std::string moduleName = modSettings[i].moduleName; + std::string modulePath = basePath + "/mod_" + moduleName + ".so"; printfd(__FILE__, "Module: %s\n", modulePath.c_str()); try { -- 2.44.2 From 6d032ed9c94ab685f8df00f7be3dbf99e4c4e31e Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Wed, 13 Apr 2016 10:18:31 +0300 Subject: [PATCH 15/16] Ticket 26. The break operator moved into the external if() construction in the PluginManager::reload() function. --- projects/stargazer/plugin_mgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stargazer/plugin_mgr.cpp b/projects/stargazer/plugin_mgr.cpp index b127869b..85215c7b 100644 --- a/projects/stargazer/plugin_mgr.cpp +++ b/projects/stargazer/plugin_mgr.cpp @@ -120,8 +120,8 @@ void PluginManager::reload(const SETTINGS_IMPL& settings) printfd(__FILE__, "Error reloading module '%s': '%s'\n", plugin.GetVersion().c_str(), plugin.GetStrError().c_str()); } + break; } - break; } } } -- 2.44.2 From 569c3a5995d3ed8875160d13461628c092da211d Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Wed, 13 Apr 2016 10:47:19 +0300 Subject: [PATCH 16/16] Ticket 26. The 'set' replaced to 'rhs' in the SETTINGS_IMPL::operator=. --- projects/stargazer/settings_impl.cpp | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/projects/stargazer/settings_impl.cpp b/projects/stargazer/settings_impl.cpp index a50a0a65..c1a3951c 100644 --- a/projects/stargazer/settings_impl.cpp +++ b/projects/stargazer/settings_impl.cpp @@ -99,36 +99,36 @@ SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval) { } //----------------------------------------------------------------------------- -SETTINGS_IMPL & SETTINGS_IMPL::operator=(const SETTINGS_IMPL & set) +SETTINGS_IMPL & SETTINGS_IMPL::operator=(const SETTINGS_IMPL & rhs) { - modulesPath = set.modulesPath; - dirName = set.dirName; - confDir = set.confDir; - scriptsDir = set.scriptsDir; - rules = set.rules; - logFile = set.logFile; - pidFile = set.pidFile; - monitorDir = set.monitorDir; - scriptParams = set.scriptParams; - monitoring = set.monitoring; - detailStatWritePeriod = set.detailStatWritePeriod; - statWritePeriod = set.statWritePeriod; - stgExecMsgKey = set.stgExecMsgKey; - executersNum = set.executersNum; - fullFee = set.fullFee; - dayFee = set.dayFee; - dayResetTraff = set.dayResetTraff; - spreadFee = set.spreadFee; - freeMbAllowInet = set.freeMbAllowInet; - dayFeeIsLastDay = set.dayFeeIsLastDay; - writeFreeMbTraffCost = set.writeFreeMbTraffCost; - showFeeInCash = set.showFeeInCash; - messageTimeout = set.messageTimeout; - feeChargeType = set.feeChargeType; - reconnectOnTariffChange = set.reconnectOnTariffChange; - - modulesSettings = set.modulesSettings; - storeModuleSettings = set.storeModuleSettings; + modulesPath = rhs.modulesPath; + dirName = rhs.dirName; + confDir = rhs.confDir; + scriptsDir = rhs.scriptsDir; + rules = rhs.rules; + logFile = rhs.logFile; + pidFile = rhs.pidFile; + monitorDir = rhs.monitorDir; + scriptParams = rhs.scriptParams; + monitoring = rhs.monitoring; + detailStatWritePeriod = rhs.detailStatWritePeriod; + statWritePeriod = rhs.statWritePeriod; + stgExecMsgKey = rhs.stgExecMsgKey; + executersNum = rhs.executersNum; + fullFee = rhs.fullFee; + dayFee = rhs.dayFee; + dayResetTraff = rhs.dayResetTraff; + spreadFee = rhs.spreadFee; + freeMbAllowInet = rhs.freeMbAllowInet; + dayFeeIsLastDay = rhs.dayFeeIsLastDay; + writeFreeMbTraffCost = rhs.writeFreeMbTraffCost; + showFeeInCash = rhs.showFeeInCash; + messageTimeout = rhs.messageTimeout; + feeChargeType = rhs.feeChargeType; + reconnectOnTariffChange = rhs.reconnectOnTariffChange; + + modulesSettings = rhs.modulesSettings; + storeModuleSettings = rhs.storeModuleSettings; return *this; } //----------------------------------------------------------------------------- -- 2.44.2