git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Patch from SpiderX <spiderx@spiderx.dp.ua> - path to FreeRADIUS plugins.
[stg.git]
/
projects
/
stargazer
/
main.cpp
diff --git
a/projects/stargazer/main.cpp
b/projects/stargazer/main.cpp
index 80ec465b709bbeef47a85ae96553c0f53ba80f5b..cabd991be6361e3f08695173b9387f4d903acaaa 100644
(file)
--- a/
projects/stargazer/main.cpp
+++ b/
projects/stargazer/main.cpp
@@
-46,9
+46,7
@@
#include "stg/plugin.h"
#include "stg/logger.h"
#include "stg/scriptexecuter.h"
#include "stg/plugin.h"
#include "stg/logger.h"
#include "stg/scriptexecuter.h"
-#include "stg/conffiles.h"
#include "stg/version.h"
#include "stg/version.h"
-#include "stg/pinger.h"
#include "stg_timer.h"
#include "settings_impl.h"
#include "users_impl.h"
#include "stg_timer.h"
#include "settings_impl.h"
#include "users_impl.h"
@@
-101,7
+99,11
@@
else
}
}
//-----------------------------------------------------------------------------
}
}
//-----------------------------------------------------------------------------
+#ifdef LINUX
int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings)
int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS_IMPL * settings)
+#else
+int StartScriptExecuter(char *, int msgKey, int * msgID, SETTINGS_IMPL * settings)
+#endif
{
STG_LOGGER & WriteServLog = GetStgLogger();
{
STG_LOGGER & WriteServLog = GetStgLogger();
@@
-142,12
+144,20
@@
switch (executerPid)
case 0:
delete settings;
case 0:
delete settings;
+#ifdef LINUX
Executer(*msgID, executerPid, procName);
Executer(*msgID, executerPid, procName);
+#else
+ Executer(*msgID, executerPid);
+#endif
return 1;
default:
if (executersPid.empty()) {
return 1;
default:
if (executersPid.empty()) {
+#ifdef LINUX
Executer(*msgID, executerPid, NULL);
Executer(*msgID, executerPid, NULL);
+#else
+ Executer(*msgID, executerPid);
+#endif
}
executersPid.insert(executerPid);
}
}
executersPid.insert(executerPid);
}
@@
-161,11
+171,11
@@
int ForkAndWait(const string &)
#endif
{
#ifndef NO_DAEMON
#endif
{
#ifndef NO_DAEMON
-
stgC
hildPid = fork();
+
pid_t c
hildPid = fork();
string startFile = confDir + START_FILE;
unlink(startFile.c_str());
string startFile = confDir + START_FILE;
unlink(startFile.c_str());
-switch (
stgC
hildPid)
+switch (
c
hildPid)
{
case -1:
return -1;
{
case -1:
return -1;
@@
-286,6
+296,10
@@
for (size_t i = 0; i < settings->GetExecutersNum(); i++)
PIDFile pidFile(settings->GetPIDFileName());
PIDFile pidFile(settings->GetPIDFileName());
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
StartTimer();
WaitTimer();
if (!IsStgTimerRunning())
StartTimer();
WaitTimer();
if (!IsStgTimerRunning())
@@
-349,7
+363,8
@@
while (modIter != modules.end())
{
if (modIter->Load())
{
{
if (modIter->Load())
{
- WriteServLog("Error: %s",
+ WriteServLog("Error loading module '%s': %s",
+ modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
goto exitLblNotStarted;
}
modIter->GetStrError().c_str());
goto exitLblNotStarted;
}
@@
-376,7
+391,8
@@
while (modIter != modules.end())
{
if (modIter->Start())
{
{
if (modIter->Start())
{
- WriteServLog("Error: %s",
+ WriteServLog("Error starting module '%s': %s",
+ modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
goto exitLbl;
}
modIter->GetStrError().c_str());
goto exitLbl;
}
@@
-393,10
+409,6
@@
WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
creat(startFile.c_str(), S_IRUSR);
#endif
creat(startFile.c_str(), S_IRUSR);
#endif
-sigset_t signalSet;
-sigfillset(&signalSet);
-pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
-
while (true)
{
sigfillset(&signalSet);
while (true)
{
sigfillset(&signalSet);
@@
-415,9
+427,9
@@
while (true)
{
if (modIter->Reload())
{
{
if (modIter->Reload())
{
- WriteServLog("Error reloading
%s ('%s')
", modIter->GetPlugin()->GetVersion().c_str(),
+ WriteServLog("Error reloading
module '%s': '%s'
", modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
modIter->GetStrError().c_str());
- printfd(__FILE__, "Error reloading
%s ('%s')
\n", modIter->GetPlugin()->GetVersion().c_str(),
+ printfd(__FILE__, "Error reloading
module '%s': '%s'
\n", modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
}
}
modIter->GetStrError().c_str());
}
}
@@
-463,12
+475,15
@@
while (modIter != modules.end())
printfd(__FILE__, "Stopping module '%s'\n", name.c_str());
if (modIter->Stop())
{
printfd(__FILE__, "Stopping module '%s'\n", name.c_str());
if (modIter->Stop())
{
- WriteServLog("
Module \'%s\': Error
: %s",
+ WriteServLog("
Error stopping module '%s'
: %s",
modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
modIter->GetPlugin()->GetVersion().c_str(),
modIter->GetStrError().c_str());
- printfd(__FILE__, "Failed to stop module '%s'\n", name.c_str());
+ printfd(__FILE__, "Error stopping module '%s': '%s'\n", modIter->GetPlugin()->GetVersion().c_str(), modIter->GetStrError().c_str());
+ }
+ else
+ {
+ WriteServLog("Module: '%s'. Stop successfull.", modIter->GetPlugin()->GetVersion().c_str());
}
}
- WriteServLog("Module: \'%s\'. Stop successfull.", modIter->GetPlugin()->GetVersion().c_str());
++modIter;
}
++modIter;
}
@@
-492,10
+507,10
@@
while (modIter != modules.end())
printfd(__FILE__, "Unloading module '%s'\n", name.c_str());
if (modIter->Unload())
{
printfd(__FILE__, "Unloading module '%s'\n", name.c_str());
if (modIter->Unload())
{
- WriteServLog("
Module \'%s\': Error: %s
",
-
name
.c_str(),
+ WriteServLog("
Error unloading module '%s': '%s'
",
+
modIter->GetPlugin()->GetVersion()
.c_str(),
modIter->GetStrError().c_str());
modIter->GetStrError().c_str());
- printfd(__FILE__, "
Failed to unload module '%s'\n", name
.c_str());
+ printfd(__FILE__, "
Error unloading module '%s': '%s'\n", modIter->GetPlugin()->GetVersion().c_str(), modIter->GetStrError()
.c_str());
}
}
++modIter;
}
}
++modIter;