1 #ifndef CONNECT___THREADED_SERVER__HPP
2 #define CONNECT___THREADED_SERVER__HPP
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
Exceptions thrown by CThreadedServer::Run.
#define NCBI_DEPRECATED_CLASS
Macro used to mark a class as deprecated.
virtual const char * GetErrCodeString(void) const override
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
EIO_Status SOCK_Close(SOCK sock)
Close the SOCK handle, and destroy all relevant internal data.
CListeningSocket m_LSock
Listening socket.
unsigned short GetPort() const
Get the listening port number back.
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT CThreadedServer
CThreadedServer - abstract class for network servers using thread pools.
const STimeout * m_AcceptTimeout
Maximum time between exit checks.
unsigned int m_QueueSize
Maximum size of request queue.
void Run(void)
Enter the main loop.
unsigned short m_Port
TCP port to listen on.
unsigned int m_InitThreads
Settings for thread pool (which is local to Run):
void StartListening(void)
Start listening immediately, or throw an exception if it is impossible to do so.
virtual ~CThreadedServer()
bool m_TemporarilyStopListening
Temporarily close listener when queue fills?
virtual bool ShutdownRequested(void)
Runs synchronously between iterations.
virtual void ProcessOverflow(SOCK sock)
Runs synchronously when request queue is full.
NCBI_EXCEPTION_DEFAULT(CThreadedServerException, CConnException)
virtual void Process(SOCK sock)=0
Runs asynchronously (from a separate thread) for each request.
virtual void ProcessTimeout(void)
Runs synchronously when accept has timed out.
unsigned int m_MaxThreads
Maximum simultaneous threads.
virtual void SetParams()
Called at the beginning of Run, before creating thread pool.
unsigned int m_SpawnThreshold
Controls when to spawn more threads.
@ eBadParameters
Out-of-range parameters given.
#define NCBI_XCONNECT_EXPORT