<<
"assertion_failed: "<< expr;
80 static const char kSection[] =
"task_server";
98 result&= it->ReadyForShutdown();
120 SRV_LOG(
Error,
"Soft shutdown timeout has expired. Trying harder.");
146memset(&sa, 0,
sizeof(sa));
148sa.sa_flags = SA_RESTART;
149sigaction(SIGINT, &sa,
NULL);
150sigaction(SIGTERM, &sa,
NULL);
152sa.sa_handler = SIG_IGN;
153sigaction(SIGPIPE, &sa,
NULL);
173<<
"\" cannot be opened");
180ifs.open( ini.c_str(),
IOS_BASE::in| IOS_BASE::binary);
181 if(!ifs.is_open()) {
232 stringis(
"\": "), eol(
",\n\"");
283 for(
int i= 0;
i< argc; ++
i) {
284cmd_line += argv[
i];
285cmd_line.append(1,
' ');
287cmd_line.resize(cmd_line.size() - 1);
295 for(
int i= 1;
i< argc; ++
i) {
296 stringparam(argv[
i]);
297 if(param ==
"-conffile") {
305cerr <<
"Parameter -conffile misses file name"<< endl;
310 else if(param ==
"-logfile") {
315cerr <<
"Parameter -logfile misses file name"<< endl;
324 memmove(&argv[
i], &argv[
i+ 2], (argc - (
i+ 2)) *
sizeof(argv[
i]));
394 switch(shutdown_type) {
void ConfigureScheduler(const CNcbiRegistry *reg, CTempString section)
bool ReConfig_Scheduler(const CTempString §ion, const CNcbiRegistry ®, string &)
void WriteSetup_Scheduler(CSrvSocketTask &task)
bool SchedIsAllIdle(void)
Mutex created to have minimum possible size (its size is 4 bytes) and to sleep using kernel capabilit...
void Unlock(void)
Unlock the mutex.
void Lock(void)
Lock the mutex.
Interface for an object wishing to be notified when server is going to shutdown.
CSrvShutdownCallback(void)
virtual ~CSrvShutdownCallback(void)
Task controlling a socket.
CSrvSocketTask & WriteText(CTempString message)
Write text into socket.
CSrvSocketTask & WriteNumber(NumType num)
Write number into socket as string, i.e.
Class incorporating convenient methods to work with struct timespec.
time_t & Sec(void)
Read/set number of seconds since epoch stored in the object.
static CSrvTime Current(void)
Exact current time with precision up to nanoseconds.
static const CNcbiRegistry & GetConfRegistry(void)
Obtains reference to registry read from application's ini-file.
static CNcbiRegistry & SetConfRegistry(void)
Used to modify original registry (to reflect RECONF modifications)
static void RequestShutdown(ESrvShutdownType shutdown_type)
Asks server to start shutdown procedures.
static bool ReadConfiguration(CNcbiRegistry *®)
Load (re-read) configuration from current conf file into another registry It is used in RECONF comman...
static void AddShutdownCallback(CSrvShutdownCallback *callback)
Adds new object wishing to receive callbacks when server is going to shutdown and wishing to influenc...
static void Finalize(void)
Finalizes TaskServer infrastructure.
static bool ReConfig(const CNcbiRegistry &new_reg, string &err_message)
static void WriteSetup(CSrvSocketTask &task)
static bool Initialize(int &argc, const char **argv)
Initializes TaskServer infrastructure from given command line arguments.
static void Run(void)
Run all TaskServer machinery.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void Critical(CExceptionArgs_Base &args)
void Error(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
void Fatal(CExceptionArgs_Base &args)
static string NormalizePath(const string &path, EFollowLinks follow_links=eIgnoreLinks)
Normalize a path.
static bool IsAbsolutePath(const string &path)
Check if a "path" is absolute for the current OS.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
static string GetCwd(void)
Get the current working directory.
virtual int GetInt(const string §ion, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
IRWRegistry * Read(CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
Read and parse the stream "is", and merge its content with current Registry entries.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
void SaveAppCmdLine(const string &cmd_line)
void ConfigureLogging(const CNcbiRegistry *reg, CTempString section)
void WriteSetup_Logging(CSrvSocketTask &task)
void FinalizeLogging(void)
void SetLogFileName(CTempString name)
bool ReConfig_Logging(const CTempString §ion, const CNcbiRegistry &new_reg, string &)
void FinalizeMemoryMan(void)
void assertion_failed(char const *expr, char const *func, char const *file, long line)
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
static bool s_IsReadyForShutdown(void)
static void s_ConfigureTaskServer(const CNcbiRegistry *reg, CTempString section)
static int s_SlowShutdownTO
void ExtractFileName(const char *file, const char *&file_name, size_t &name_size)
static int s_FastShutdownTO
static bool s_ReadConfiguration(void)
static CMiniMutex s_SDListLock
static CNcbiRegistry * s_Registry
static const char kSection[]
static void s_TermHandler(int)
static TShutdownList s_ShutdownList
static CSrvTime s_ShutdownStartTime
static EServerState s_SeenSDState
static void s_InitSignals(void)
void TrackShuttingDown(void)
static int s_AbortShutdownTO
static bool s_ProcessParameters(int &argc, const char **argv)
static bool s_LoadConfFile(CNcbiRegistry *®)
bool ReConfig_Sockets(const CTempString §ion, const CNcbiRegistry &new_reg, string &)
void RequestStopListening(void)
bool InitSocketsMan(void)
bool StartSocketsMan(void)
void ConfigureSockets(const CNcbiRegistry *reg, CTempString section)
void WriteSetup_Sockets(CSrvSocketTask &task)
void FinalizeSocketsMan(void)
#define SRV_LOG(sev, msg)
Macro to be used for printing log messages.
bool AtomicCAS(T volatile &var, T old_value, T new_value)
CRef< IRWRegistry > registry
ESrvShutdownType
Types of server shutdown procedures that one can request from CTaskServer.
intr::slist< CSrvShutdownCallback, TSDListHookOpt, intr::constant_time_size< false >, intr::cache_last< false > > TShutdownList
void ConfigureThreads(const CNcbiRegistry *reg, CTempString section)
bool InitThreadsMan(void)
bool ReConfig_Threads(const CTempString &, const CNcbiRegistry &, string &)
void WriteSetup_Threads(CSrvSocketTask &task)
void FinalizeThreadsMan(void)
bool ReConfig_TimeMan(const CTempString &, const CNcbiRegistry &, string &)
void WriteSetup_TimeMan(CSrvSocketTask &task)
void ConfigureTimeMan(const CNcbiRegistry *reg, CTempString section)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4