NCBI C++ ToolKit
Classes | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends
Threaded Server
+ Collaboration diagram for Threaded Server:

Classes

class  IServer_ConnectionBase
 
class  CServer_Connection
 
class  CServer_Listener
 
class  CServer
 CServer:: More...
 
class  IServer_ConnectionHandler
 IServer_ConnectionHandler:: More...
 
class  IServer_MessageHandler
 IServer_MessageHandler:: More...
 
class  IServer_LineMessageHandler
 IServer_LineMessageHandler:: More...
 
class  IServer_StreamHandler
 IServer_StreamHandler:: More...
 
class  IServer_ConnectionFactory
 IServer_ConnectionFactory:: More...
 
class  CServer_ConnectionFactory< TServer_ConnectionHandler >
 CServer_ConnectionFactory:: More...
 
struct  SServer_Parameters
 SServer_Parameters:: More...
 
class  CServer_Exception
 CServer_Exception:: More...
 
struct  IServer_Monitor
 Base interface for monitoring. More...
 
class  CServer_Monitor
 Server monitor. More...
 
class  CThreadedServerException
 Exceptions thrown by CThreadedServer::Run. More...
 
class  CServer_ConnectionPool
 

Typedefs

typedef IServer_ConnectionBase CServer_ConnectionPool::TConnBase
 
typedef CServer_Connection CServer_ConnectionPool::TConnection
 
typedef CServer_Listener CServer_ConnectionPool::TListener
 
typedef set< TConnBase * > CServer_ConnectionPool::TData
 

Enumerations

enum  EServerConnType {
  eInactiveSocket , eActiveSocket , eListener , ePreDeferredSocket ,
  eDeferredSocket , ePreClosedSocket , eClosedSocket
}
 
enum  EServIO_Event {
  eServIO_Open = 0x00 , eServIO_Read = 0x01 , eServIO_Write = 0x02 , eServIO_ReadWrite = 0x03 ,
  eServIO_ClientClose = 0x04 , eServIO_OurClose = 0x08 , eServIO_Inactivity = 0x10 , eServIO_Delete = 0x20 ,
  eServIO_Alarm = 0x40
}
 Extended copy of the type EIO_Event allowing to distinguish between connection closing from client and from ourselves. More...
 
enum  EOverflowReason { eOR_Unknown = 0 , eOR_ConnectionPoolFull , eOR_RequestQueueFull , eOR_UnpollableSocket }
 Error codes for OnOverflow method in IServer_ConnectionHandler. More...
 
enum  IServer_ConnectionHandler::EClosePeer { IServer_ConnectionHandler::eOurClose , IServer_ConnectionHandler::eClientClose }
 Type of connection closing. More...
 
enum  IServer_ConnectionFactory::EListenAction { IServer_ConnectionFactory::eLAFail = 0 , IServer_ConnectionFactory::eLAIgnore = 1 , IServer_ConnectionFactory::eLARetry = 2 }
 What to do if the port is busy. More...
 
enum  CServer_Exception::EErrCode { CServer_Exception::eBadParameters , CServer_Exception::eCouldntListen , CServer_Exception::ePoolOverflow }
 
enum  CThreadedServerException::EErrCode { CThreadedServerException::eBadParameters , CThreadedServerException::eCouldntListen }
 

Functions

std::string g_ServerConnTypeToString (enum EServerConnType conn_type)
 
virtual IServer_ConnectionBase::~IServer_ConnectionBase ()
 
virtual EIO_Event IServer_ConnectionBase::GetEventsToPollFor (const CTime **) const
 
virtual CStdRequestIServer_ConnectionBase::CreateRequest (EServIO_Event event, CServer_ConnectionPool &connPool, const STimeout *timeout)=0
 
virtual bool IServer_ConnectionBase::IsOpen (void)
 
virtual bool IServer_ConnectionBase::IsReadyToProcess (void)
 
virtual void IServer_ConnectionBase::OnTimeout (void)
 
virtual void IServer_ConnectionBase::OnTimer (void)
 
virtual void IServer_ConnectionBase::OnOverflow (EOverflowReason)
 
virtual void IServer_ConnectionBase::Activate (void)
 
virtual void IServer_ConnectionBase::Passivate (void)
 
 CServer_Connection::CServer_Connection (IServer_ConnectionHandler *handler)
 
virtual EIO_Event CServer_Connection::GetEventsToPollFor (const CTime **alarm_time) const
 
virtual CStdRequestCServer_Connection::CreateRequest (EServIO_Event event, CServer_ConnectionPool &connPool, const STimeout *timeout)
 
virtual void CServer_Connection::OnTimeout (void)
 
virtual void CServer_Connection::OnOverflow (EOverflowReason reason)
 
virtual bool CServer_Connection::IsReadyToProcess (void)
 
virtual bool CServer_Connection::IsOpen (void)
 
void CServer_Connection::OnSocketEvent (EServIO_Event event)
 
virtual CServer_Connection::~CServer_Connection ()
 
 CServer_Listener::CServer_Listener (IServer_ConnectionFactory *factory, unsigned short port)
 
virtual CStdRequestCServer_Listener::CreateRequest (EServIO_Event event, CServer_ConnectionPool &connPool, const STimeout *timeout)
 
virtual void CServer_Listener::Activate (void)
 
virtual void CServer_Listener::Passivate (void)
 
unsigned short CServer_Listener::GetPort (void) const
 
EServIO_Event IOEventToServIOEvent (EIO_Event event)
 Transform EIO_Event type to EServIO_Event. More...
 
 CServer::CServer (void)
 
virtual CServer::~CServer ()
 
void CServer::AddListener (IServer_ConnectionFactory *factory, unsigned short port)
 Register a listener. More...
 
bool CServer::RemoveListener (unsigned short port)
 Removes a listener. More...
 
void CServer::SetParameters (const SServer_Parameters &new_params)
 
void CServer::GetParameters (SServer_Parameters *params)
 
void CServer::StartListening (void)
 Start listening before the main loop. More...
 
void CServer::Run (void)
 Enter the main loop. More...
 
void CServer::SubmitRequest (const CRef< CStdRequest > &request)
 Submit request to be executed by the server thread pool. More...
 
void CServer::DeferConnectionProcessing (IServer_ConnectionBase *conn)
 Mark connection as deferred for processing, i.e. More...
 
void CServer::DeferConnectionProcessing (CSocket *sock)
 
void CServer::CloseConnection (CSocket *sock)
 Close connection. More...
 
void CServer::AddConnectionToPool (CServer_Connection *conn)
 Add externally created connection to the connection pool which server polls on. More...
 
void CServer::RemoveConnectionFromPool (CServer_Connection *conn)
 Remove externally created connection from pool. More...
 
void CServer::WakeUpPollCycle (void)
 Force poll cycle to make another iteration. More...
 
void CServer::SetCustomThreadSuffix (const string &suffix)
 Set custom suffix to use on all threads in the server's pool. More...
 
vector< unsigned short > CServer::GetListenerPorts (void)
 Provides a list of ports on which the server is listening. More...
 
virtual void CServer::Init ()
 Initialize the server. More...
 
virtual void CServer::Exit ()
 Cleanup the server. More...
 
virtual void CServer::ProcessTimeout (void)
 Runs synchronously when no socket activity has occurred in a while (as determined by m_AcceptTimeout). More...
 
virtual bool CServer::ShutdownRequested (void)
 Runs synchronously between iterations. More...
 
void CServer::x_DoRun (void)
 
CPoolOfThreads_ForServerCServer::GetThreadPool (void)
 
virtual IServer_ConnectionHandler::~IServer_ConnectionHandler ()
 
virtual EIO_Event IServer_ConnectionHandler::GetEventsToPollFor (const CTime **) const
 Following three methods are guaranteed to be called NOT at the same time as On*, so if you implement them you should not guard the variables which they can use with mutexes. More...
 
virtual const STimeoutIServer_ConnectionHandler::GetTimeout (void)
 Returns the timeout for this connection. More...
 
virtual bool IServer_ConnectionHandler::IsOpen (void)
 Returns connection handler's perception of whether we open or not. More...
 
virtual bool IServer_ConnectionHandler::IsReadyToProcess (void) const
 Returns the handler's readiness to process input data or to write some output data. More...
 
virtual void IServer_ConnectionHandler::OnOpen (void)=0
 Runs in response to an external event [asynchronous]. More...
 
virtual void IServer_ConnectionHandler::OnRead (void)=0
 The client has just sent data. More...
 
virtual void IServer_ConnectionHandler::OnWrite (void)=0
 The client is ready to receive data. More...
 
virtual void IServer_ConnectionHandler::OnClose (EClosePeer)
 The connection has closed (with information on type of closing) More...
 
virtual void IServer_ConnectionHandler::OnTimeout (void)
 Runs when a client has been idle for too long, prior to closing the connection [synchronous]. More...
 
virtual void IServer_ConnectionHandler::OnTimer (void)
 This method is called at the moment in time specified earlier by the alarm_time parameter of the GetEventsToPollFor method [synchronous]. More...
 
virtual void IServer_ConnectionHandler::OnOverflow (EOverflowReason)
 Runs when there are insufficient resources to queue a connection, prior to closing it. More...
 
virtual void IServer_ConnectionHandler::OnError (const string &)
 Runs when a socket error is detected. More...
 
CSocketIServer_ConnectionHandler::GetSocket (void)
 Get underlying socket. More...
 
void IServer_ConnectionHandler::SetSocket (CSocket *socket)
 
 IServer_MessageHandler::IServer_MessageHandler ()
 
virtual IServer_MessageHandler::~IServer_MessageHandler ()
 
virtual void IServer_MessageHandler::OnRead (void)
 The client has just sent data. More...
 
virtual int IServer_MessageHandler::CheckMessage (BUF *buffer, const void *data, size_t size)=0
 
virtual void IServer_MessageHandler::OnMessage (BUF buffer)=0
 
int Server_CheckLineMessage (BUF *buffer, const void *data, size_t size, bool &seen_CR)
 
 IServer_LineMessageHandler::IServer_LineMessageHandler ()
 
virtual int IServer_LineMessageHandler::CheckMessage (BUF *buffer, const void *data, size_t size)
 
CNcbiIostreamIServer_StreamHandler::GetStream ()
 
virtual IServer_ConnectionFactory::~IServer_ConnectionFactory ()
 
virtual IServer_ConnectionHandlerIServer_ConnectionFactory::Create (void)=0
 
virtual EListenAction IServer_ConnectionFactory::OnFailure (unsigned short *)
 Return desired action if the port, mentioned in AddListener is busy. More...
 
virtual IServer_ConnectionHandlerCServer_ConnectionFactory< TServer_ConnectionHandler >::Create ()
 
 SServer_Parameters::SServer_Parameters ()
 Create structure with the default set of parameters. More...
 
virtual const char * CServer_Exception::GetErrCodeString (void) const override
 
 CServer_Exception::NCBI_EXCEPTION_DEFAULT (CServer_Exception, CConnException)
 
virtual IServer_Monitor::~IServer_Monitor ()
 
virtual bool IServer_Monitor::IsActive ()=0
 Check if monitoring is active. More...
 
virtual void IServer_Monitor::Send (const char *msg, size_t length)=0
 Send message. More...
 
virtual void IServer_Monitor::Send (const string &str)=0
 Send message. More...
 
 CServer_Monitor::CServer_Monitor ()
 Server monitor. More...
 
virtual CServer_Monitor::~CServer_Monitor ()
 
void CServer_Monitor::SetSocket (CSocket &socket)
 Pass open socket for monitor output. More...
 
bool CServer_Monitor::IsMonitorActive ()
 
void CServer_Monitor::SendMessage (const char *msg, size_t length)
 
void CServer_Monitor::SendString (const string &str)
 
 CServer_Monitor::CServer_Monitor (const CServer_Monitor &)
 
CServer_MonitorCServer_Monitor::operator= (const CServer_Monitor &)
 
virtual const char * CThreadedServerException::GetErrCodeString (void) const override
 
 CThreadedServerException::NCBI_EXCEPTION_DEFAULT (CThreadedServerException, CConnException)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_MaxThreads (10)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_QueueSize (20)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_SpawnThreshold (1)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_AcceptTimeout (kInfiniteTimeout)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_TemporarilyStopListening (false)
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_Port (port)
 
virtual ~CThreadedServer ()
 
void Run (void)
 Enter the main loop. More...
 
void StartListening (void)
 Start listening immediately, or throw an exception if it is impossible to do so. More...
 
virtual void Process (SOCK sock)=0
 Runs asynchronously (from a separate thread) for each request. More...
 
unsigned short GetPort () const
 Get the listening port number back. More...
 
virtual void ProcessOverflow (SOCK sock)
 Runs synchronously when request queue is full. More...
 
virtual void ProcessTimeout (void)
 Runs synchronously when accept has timed out. More...
 
virtual bool ShutdownRequested (void)
 Runs synchronously between iterations. More...
 
virtual void SetParams ()
 Called at the beginning of Run, before creating thread pool. More...
 
 CServer_ConnectionPool::CServer_ConnectionPool (unsigned max_connections)
 
 CServer_ConnectionPool::~CServer_ConnectionPool ()
 
void CServer_ConnectionPool::SetMaxConnections (unsigned max_connections)
 
bool CServer_ConnectionPool::Add (TConnBase *conn, EServerConnType type)
 
void CServer_ConnectionPool::Remove (TConnBase *conn)
 
bool CServer_ConnectionPool::RemoveListener (unsigned short port)
 
void CServer_ConnectionPool::PingControlConnection (void)
 
void CServer_ConnectionPool::SetConnType (TConnBase *conn, EServerConnType type)
 Guard connection from out-of-order packet processing by pulling eActiveSocket's from poll vector Resets the expiration time as a bonus. More...
 
void CServer_ConnectionPool::SetAllActive (const vector< CSocketAPI::SPoll > &polls)
 
void CServer_ConnectionPool::SetAllActive (const vector< IServer_ConnectionBase * > &conns)
 
void CServer_ConnectionPool::CloseConnection (TConnBase *conn)
 Close connection as if it was initiated by server (not by client). More...
 
void CServer_ConnectionPool::Erase (void)
 Erase all connections. More...
 
bool CServer_ConnectionPool::GetPollAndTimerVec (vector< CSocketAPI::SPoll > &polls, vector< IServer_ConnectionBase * > &timer_requests, STimeout *timer_timeout, vector< IServer_ConnectionBase * > &revived_conns, vector< IServer_ConnectionBase * > &to_close_conns, vector< IServer_ConnectionBase * > &to_delete_conns)
 
void CServer_ConnectionPool::StartListening (void)
 
void CServer_ConnectionPool::StopListening (void)
 
vector< unsigned short > CServer_ConnectionPool::GetListenerPorts (void)
 Provides a list of ports on which the server is listening. More...
 
void CServer_ConnectionPool::x_UpdateExpiration (TConnBase *conn)
 

Variables

CTime IServer_ConnectionBase::expiration
 
CFastMutex IServer_ConnectionBase::type_lock
 
volatile EServerConnType IServer_ConnectionBase::type
 
unique_ptr< IServer_ConnectionHandlerCServer_Connection::m_Handler
 
bool CServer_Connection::m_Open
 
unique_ptr< IServer_ConnectionFactoryCServer_Listener::m_Factory
 
unsigned short CServer_Listener::m_Port
 
SServer_ParametersCServer::m_Parameters
 
CServer_ConnectionPoolCServer::m_ConnectionPool
 
CPoolOfThreads_ForServerCServer::m_ThreadPool
 
string CServer::m_ThreadSuffix
 
CSocketIServer_ConnectionHandler::m_Socket
 
BUF IServer_MessageHandler::m_Buffer
 
bool IServer_LineMessageHandler::m_SeenCR
 
CConn_SocketStream IServer_StreamHandler::m_Stream
 
unsigned int SServer_Parameters::max_connections
 Maximum # of open connections. More...
 
bool SServer_Parameters::temporarily_stop_listening
 Temporarily close listener when queue fills? More...
 
const STimeoutSServer_Parameters::accept_timeout
 Maximum t between exit checks. More...
 
const STimeoutSServer_Parameters::idle_timeout
 For how long to keep inactive non-listening sockets open (default: 10 minutes) More...
 
unsigned int SServer_Parameters::init_threads
 Number of initial threads. More...
 
unsigned int SServer_Parameters::max_threads
 Maximum simultaneous threads. More...
 
unsigned int SServer_Parameters::spawn_threshold
 Controls when to spawn more threads. More...
 
CFastMutex CServer_Monitor::m_Lock
 
CSocketCServer_Monitor::m_Sock
 
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT CThreadedServer
 CThreadedServer - abstract class for network servers using thread pools. More...
 
unsigned int m_InitThreads
 Settings for thread pool (which is local to Run): More...
 
unsigned int m_MaxThreads
 Maximum simultaneous threads. More...
 
unsigned int m_QueueSize
 Maximum size of request queue. More...
 
unsigned int m_SpawnThreshold
 Controls when to spawn more threads. More...
 
const STimeoutm_AcceptTimeout
 Maximum time between exit checks. More...
 
bool m_TemporarilyStopListening
 Temporarily close listener when queue fills? More...
 
unsigned short m_Port
 TCP port to listen on. More...
 
CListeningSocket m_LSock
 Listening socket. More...
 
TData CServer_ConnectionPool::m_Data
 
CMutex CServer_ConnectionPool::m_Mutex
 
unsigned int CServer_ConnectionPool::m_MaxConnections
 
CTrigger CServer_ConnectionPool::m_ControlTrigger
 
vector< unsigned short > CServer_ConnectionPool::m_ListenerPortsToStop
 
bool CServer_ConnectionPool::m_ListeningStarted
 

Friends

class IServer_ConnectionBase::CServer_ConnectionPool
 
class IServer_ConnectionBase::IServer_MessageHandler
 
class CServer_Listener::CAcceptRequest
 
class CServer::CNetCacheServer
 
class IServer_ConnectionHandler::CServer_Connection
 

IServer_Monitor interface

virtual bool CServer_Monitor::IsActive ()
 Check if monitoring is active. More...
 
virtual void CServer_Monitor::Send (const char *msg, size_t length)
 Send message. More...
 
virtual void CServer_Monitor::Send (const string &str)
 Send message. More...
 

Detailed Description

Typedef Documentation

◆ TConnBase

Definition at line 55 of file connection_pool.hpp.

◆ TConnection

Definition at line 56 of file connection_pool.hpp.

◆ TData

Definition at line 100 of file connection_pool.hpp.

◆ TListener

Definition at line 57 of file connection_pool.hpp.

Enumeration Type Documentation

◆ EClosePeer

Type of connection closing.

Enumerator
eOurClose 

Connection closed by ourselves.

eClientClose 

Connection closed by other peer.

Definition at line 268 of file server.hpp.

◆ EErrCode [1/2]

Enumerator
eBadParameters 

Out-of-range parameters given.

eCouldntListen 

Unable to bind listening port.

ePoolOverflow 

Connection pool overflowed.

Definition at line 467 of file server.hpp.

◆ EErrCode [2/2]

Enumerator
eBadParameters 

Out-of-range parameters given.

eCouldntListen 

Unable to bind listening port.

Definition at line 55 of file threaded_server.hpp.

◆ EListenAction

What to do if the port is busy.

Enumerator
eLAFail 
eLAIgnore 
eLARetry 

Definition at line 391 of file server.hpp.

◆ EOverflowReason

Error codes for OnOverflow method in IServer_ConnectionHandler.

Enumerator
eOR_Unknown 
eOR_ConnectionPoolFull 
eOR_RequestQueueFull 
eOR_UnpollableSocket 

Definition at line 209 of file server.hpp.

◆ EServerConnType

Enumerator
eInactiveSocket 
eActiveSocket 
eListener 
ePreDeferredSocket 
eDeferredSocket 
ePreClosedSocket 
eClosedSocket 

Definition at line 49 of file server_connection.hpp.

◆ EServIO_Event

Extended copy of the type EIO_Event allowing to distinguish between connection closing from client and from ourselves.

Enumerator
eServIO_Open 
eServIO_Read 
eServIO_Write 
eServIO_ReadWrite 

eIO_Read | eIO_Write

eServIO_ClientClose 
eServIO_OurClose 
eServIO_Inactivity 
eServIO_Delete 
eServIO_Alarm 

Definition at line 61 of file server.hpp.

Function Documentation

◆ Activate() [1/2]

virtual void IServer_ConnectionBase::Activate ( void  )
inlinevirtual

Reimplemented in CServer_Listener.

Definition at line 77 of file server_connection.hpp.

◆ Activate() [2/2]

virtual void CServer_Listener::Activate ( void  )
inlinevirtual

◆ Add()

bool CServer_ConnectionPool::Add ( TConnBase conn,
EServerConnType  type 
)

◆ AddConnectionToPool()

void CServer::AddConnectionToPool ( CServer_Connection conn)

Add externally created connection to the connection pool which server polls on.

Throws exception if pool is full. NOTE: events to this connection can come theoretically even NOTE: if connection gets some error or its peer closes it then conn object will be deleted after processing OnClose event. If you don't want that you have to call RemoveConnectionFromPool while handling OnClose.

Definition at line 824 of file server.cpp.

References CServer_ConnectionPool::Add(), conn, eInactiveSocket, CServer::m_ConnectionPool, and NCBI_THROW.

◆ AddListener()

void CServer::AddListener ( IServer_ConnectionFactory factory,
unsigned short  port 
)

◆ CheckMessage() [1/2]

virtual int IServer_LineMessageHandler::CheckMessage ( BUF buffer,
const void *  data,
size_t  size 
)
inlinevirtual

◆ CheckMessage() [2/2]

virtual int IServer_MessageHandler::CheckMessage ( BUF buffer,
const void *  data,
size_t  size 
)
pure virtual

◆ CloseConnection() [1/2]

void CServer::CloseConnection ( CSocket sock)

◆ CloseConnection() [2/2]

void CServer_ConnectionPool::CloseConnection ( TConnBase conn)

◆ Create() [1/2]

template<class TServer_ConnectionHandler >
virtual IServer_ConnectionHandler* CServer_ConnectionFactory< TServer_ConnectionHandler >::Create ( )
inlinevirtual
Returns
a new instance of handler for connection

Implements IServer_ConnectionFactory.

Definition at line 420 of file server.hpp.

◆ Create() [2/2]

virtual IServer_ConnectionHandler* IServer_ConnectionFactory::Create ( void  )
pure virtual

◆ CreateRequest() [1/3]

CStdRequest * CServer_Connection::CreateRequest ( EServIO_Event  event,
CServer_ConnectionPool connPool,
const STimeout timeout 
)
virtual

Implements IServer_ConnectionBase.

Definition at line 521 of file server.cpp.

◆ CreateRequest() [2/3]

CStdRequest * CServer_Listener::CreateRequest ( EServIO_Event  event,
CServer_ConnectionPool connPool,
const STimeout timeout 
)
virtual

Implements IServer_ConnectionBase.

Definition at line 510 of file server.cpp.

References CServer_Listener::CAcceptRequest.

◆ CreateRequest() [3/3]

virtual CStdRequest* IServer_ConnectionBase::CreateRequest ( EServIO_Event  event,
CServer_ConnectionPool connPool,
const STimeout timeout 
)
pure virtual

Implemented in CServer_Listener, and CServer_Connection.

Referenced by CServer::x_DoRun().

◆ CServer()

CServer::CServer ( void  )

◆ CServer_Connection()

CServer_Connection::CServer_Connection ( IServer_ConnectionHandler handler)
inline

Definition at line 93 of file server_connection.hpp.

References CServer_Connection::m_Handler.

◆ CServer_ConnectionPool()

CServer_ConnectionPool::CServer_ConnectionPool ( unsigned  max_connections)

Definition at line 59 of file connection_pool.cpp.

◆ CServer_Listener()

CServer_Listener::CServer_Listener ( IServer_ConnectionFactory factory,
unsigned short  port 
)
inline

Definition at line 121 of file server_connection.hpp.

◆ CServer_Monitor() [1/2]

CServer_Monitor::CServer_Monitor ( )

Server monitor.

Definition at line 41 of file server_monitor.cpp.

◆ CServer_Monitor() [2/2]

CServer_Monitor::CServer_Monitor ( const CServer_Monitor )
private

◆ DeferConnectionProcessing() [1/2]

void CServer::DeferConnectionProcessing ( CSocket sock)

Definition at line 818 of file server.cpp.

References CServer::DeferConnectionProcessing().

◆ DeferConnectionProcessing() [2/2]

void CServer::DeferConnectionProcessing ( IServer_ConnectionBase conn)

Mark connection as deferred for processing, i.e.

do not poll on it and wait when IsReadyToProcess() will return true.

Definition at line 812 of file server.cpp.

References conn, ePreDeferredSocket, CServer::m_ConnectionPool, and CServer_ConnectionPool::SetConnType().

Referenced by CServer::DeferConnectionProcessing().

◆ Erase()

void CServer_ConnectionPool::Erase ( void  )

◆ Exit()

virtual void CServer::Exit ( void  )
inlineprotectedvirtual

Cleanup the server.

Called by Run method after poll cycle when all processing threads are stopped, but before releasing listening ports. Here you're still guaranteed that another instance running on the same set of ports will fail at StartListening point.

Reimplemented in CNetStorageServer, and CNetScheduleServer.

Definition at line 181 of file server.hpp.

Referenced by CServer::Run().

◆ g_ServerConnTypeToString()

std::string g_ServerConnTypeToString ( enum EServerConnType  conn_type)

◆ GetErrCodeString() [1/2]

const char * CServer_Exception::GetErrCodeString ( void  ) const
overridevirtual

◆ GetErrCodeString() [2/2]

const char * CThreadedServerException::GetErrCodeString ( void  ) const
overridevirtual

◆ GetEventsToPollFor() [1/3]

virtual EIO_Event IServer_ConnectionBase::GetEventsToPollFor ( const CTime **  ) const
inlinevirtual

Reimplemented in CServer_Connection.

Definition at line 67 of file server_connection.hpp.

References eIO_Read.

Referenced by CServer_ConnectionPool::GetPollAndTimerVec(), and CServer::x_DoRun().

◆ GetEventsToPollFor() [2/3]

virtual EIO_Event IServer_ConnectionHandler::GetEventsToPollFor ( const CTime **  ) const
inlinevirtual

Following three methods are guaranteed to be called NOT at the same time as On*, so if you implement them you should not guard the variables which they can use with mutexes.

Parameters
alarm_timeSet this parameter to a pointer to a CTime object to recieve an OnTimer event at the moment in time specified by this object.
Returns
Returns the set of events for which Poll should check.

Reimplemented in CNetStorageHandler.

Definition at line 239 of file server.hpp.

References eIO_Read.

◆ GetEventsToPollFor() [3/3]

virtual EIO_Event CServer_Connection::GetEventsToPollFor ( const CTime **  alarm_time) const
inlinevirtual

Reimplemented from IServer_ConnectionBase.

Definition at line 96 of file server_connection.hpp.

References CServer_Connection::m_Handler.

◆ GetListenerPorts() [1/2]

vector< unsigned short > CServer::GetListenerPorts ( void  )

Provides a list of ports on which the server is listening.

Returns
currently listened ports

Definition at line 842 of file server.cpp.

References CServer_ConnectionPool::GetListenerPorts(), and CServer::m_ConnectionPool.

◆ GetListenerPorts() [2/2]

vector< unsigned short > CServer_ConnectionPool::GetListenerPorts ( void  )

◆ GetParameters()

void CServer::GetParameters ( SServer_Parameters params)

◆ GetPollAndTimerVec()

bool CServer_ConnectionPool::GetPollAndTimerVec ( vector< CSocketAPI::SPoll > &  polls,
vector< IServer_ConnectionBase * > &  timer_requests,
STimeout timer_timeout,
vector< IServer_ConnectionBase * > &  revived_conns,
vector< IServer_ConnectionBase * > &  to_close_conns,
vector< IServer_ConnectionBase * > &  to_delete_conns 
)

◆ GetPort() [1/2]

unsigned short GetPort ( void  ) const

◆ GetPort() [2/2]

unsigned short CServer_Listener::GetPort ( void  ) const
inline

◆ GetSocket()

CSocket& IServer_ConnectionHandler::GetSocket ( void  )
inline

Get underlying socket.

Definition at line 294 of file server.hpp.

References IServer_ConnectionHandler::m_Socket.

Referenced by CRelocateCallback::Callback(), CNetScheduleHandler::OnClose(), CNetStorageHandler::OnClose(), CBDBEnvKeeperConnectionHandler::OnMessage(), CNetScheduleHandler::OnMessage(), CWNCTConnectionHandler::OnMessage(), CBDBEnvKeeperConnectionHandler::OnOpen(), CNetScheduleHandler::OnOpen(), CNetStorageHandler::OnOpen(), CWNCTConnectionHandler::OnOpen(), IServer_MessageHandler::OnRead(), CNetStorageHandler::OnRead(), CNetScheduleHandler::x_CreateConnContext(), CNetStorageHandler::x_CreateConnContext(), CNetScheduleHandler::x_GetPeerAddress(), CNetStorageHandler::x_GetPeerAddress(), CNetScheduleHandler::x_HandleSocketErrorOnResponse(), CNetScheduleHandler::x_OnCmdParserError(), CNetStorageHandler::x_OnMessage(), CNetStorageHandler::x_OnSocketWriteError(), CNetScheduleHandler::x_PrepareWriteBuffer(), CNetScheduleHandler::x_PrintCmdRequestStart(), CNetStorageHandler::x_PrintMessageRequestStart(), CNetScheduleHandler::x_ProcessMsgAuth(), CNetScheduleHandler::x_ProcessMsgBatchJob(), CNetScheduleHandler::x_ProcessMsgQueue(), CNetScheduleHandler::x_ProcessMsgRequest(), CNetScheduleHandler::x_ProcessQuitSession(), CWNCTConnectionHandler::x_ProcessRequest(), CNetScheduleHandler::x_ProcessStatistics(), CNetStorageHandler::x_ReadRawData(), CNetStorageHandler::x_SendOutputBuffer(), CNetStorageHandler::x_SendOverUTTP(), CNetScheduleHandler::x_SetQuickAcknowledge(), CNetStorageHandler::x_SetQuickAcknowledge(), and CNetScheduleHandler::x_WriteMessage().

◆ GetStream()

CNcbiIostream& IServer_StreamHandler::GetStream ( )

◆ GetThreadPool()

CPoolOfThreads_ForServer* CServer::GetThreadPool ( void  )
inlineprivate

Definition at line 197 of file server.hpp.

References CServer::m_ThreadPool.

◆ GetTimeout()

virtual const STimeout* IServer_ConnectionHandler::GetTimeout ( void  )
inlinevirtual

Returns the timeout for this connection.

Definition at line 242 of file server.hpp.

References kDefaultTimeout.

◆ Init()

virtual void CServer::Init ( void  )
inlineprotectedvirtual

Initialize the server.

Called by Run method before poll cycle.

Definition at line 173 of file server.hpp.

Referenced by CServer::x_DoRun().

◆ IOEventToServIOEvent()

EServIO_Event IOEventToServIOEvent ( EIO_Event  event)
inline

Transform EIO_Event type to EServIO_Event.

Definition at line 76 of file server.hpp.

Referenced by CServer::x_DoRun().

◆ IsActive() [1/2]

bool CServer_Monitor::IsActive ( )
virtual

Check if monitoring is active.

Implements IServer_Monitor.

Definition at line 99 of file server_monitor.cpp.

References CServer_Monitor::IsMonitorActive().

◆ IsActive() [2/2]

virtual bool IServer_Monitor::IsActive ( )
pure virtual

◆ IServer_LineMessageHandler()

IServer_LineMessageHandler::IServer_LineMessageHandler ( )
inline

Definition at line 349 of file server.hpp.

◆ IServer_MessageHandler()

IServer_MessageHandler::IServer_MessageHandler ( )
inline

Definition at line 315 of file server.hpp.

◆ IsMonitorActive()

bool CServer_Monitor::IsMonitorActive ( )

◆ IsOpen() [1/3]

virtual bool IServer_ConnectionBase::IsOpen ( void  )
inlinevirtual

Reimplemented in CServer_Connection.

Definition at line 72 of file server_connection.hpp.

Referenced by CServer_ConnectionPool::GetPollAndTimerVec().

◆ IsOpen() [2/3]

bool CServer_Connection::IsOpen ( void  )
virtual

Reimplemented from IServer_ConnectionBase.

Definition at line 528 of file server.cpp.

References CServer_Connection::m_Open.

◆ IsOpen() [3/3]

virtual bool IServer_ConnectionHandler::IsOpen ( void  )
inlinevirtual

Returns connection handler's perception of whether we open or not.

It is unsafe to just close underlying socket because of the race, emerging due to the fact that the socket can linger for a while.

Definition at line 247 of file server.hpp.

◆ IsReadyToProcess() [1/3]

virtual bool IServer_ConnectionBase::IsReadyToProcess ( void  )
inlinevirtual

Reimplemented in CServer_Connection.

Definition at line 73 of file server_connection.hpp.

Referenced by CServer_ConnectionPool::GetPollAndTimerVec().

◆ IsReadyToProcess() [2/3]

virtual bool CServer_Connection::IsReadyToProcess ( void  )
inlinevirtual

Reimplemented from IServer_ConnectionBase.

Definition at line 105 of file server_connection.hpp.

References CServer_Connection::m_Handler.

◆ IsReadyToProcess() [3/3]

virtual bool IServer_ConnectionHandler::IsReadyToProcess ( void  ) const
inlinevirtual

Returns the handler's readiness to process input data or to write some output data.

OnRead() and OnWrite() are not called unless this method return true.

Definition at line 252 of file server.hpp.

◆ m_AcceptTimeout()

◆ m_MaxThreads()

◆ m_Port()

Definition at line 84 of file threaded_server.hpp.

◆ m_QueueSize()

◆ m_SpawnThreshold()

NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_SpawnThreshold ( )

◆ m_TemporarilyStopListening()

NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT m_TemporarilyStopListening ( false  )

◆ NCBI_EXCEPTION_DEFAULT() [1/2]

CServer_Exception::NCBI_EXCEPTION_DEFAULT ( CServer_Exception  ,
CConnException   
)

◆ NCBI_EXCEPTION_DEFAULT() [2/2]

CThreadedServerException::NCBI_EXCEPTION_DEFAULT ( CThreadedServerException  ,
CConnException   
)

◆ OnClose()

virtual void IServer_ConnectionHandler::OnClose ( EClosePeer  )
inlinevirtual

The connection has closed (with information on type of closing)

Reimplemented in CNetStorageHandler, and CNetScheduleHandler.

Definition at line 274 of file server.hpp.

Referenced by IServer_MessageHandler::OnRead().

◆ OnError()

virtual void IServer_ConnectionHandler::OnError ( const string )
inlinevirtual

Runs when a socket error is detected.

Reimplemented in CNetScheduleHandler.

Definition at line 291 of file server.hpp.

Referenced by IServer_MessageHandler::OnRead().

◆ OnFailure()

virtual EListenAction IServer_ConnectionFactory::OnFailure ( unsigned short *  )
inlinevirtual

Return desired action if the port, mentioned in AddListener is busy.

If the action is eLARetry, provide new port. The

Reimplemented in CWNCTConnectionFactory.

Definition at line 403 of file server.hpp.

References IServer_ConnectionFactory::eLAFail.

◆ OnMessage()

virtual void IServer_MessageHandler::OnMessage ( BUF  buffer)
pure virtual

◆ OnOpen()

virtual void IServer_ConnectionHandler::OnOpen ( void  )
pure virtual

Runs in response to an external event [asynchronous].

You can get socket by calling GetSocket(), if you close the socket this object will be destroyed. Individual events are: A client has just established this connection.

Implemented in CWNCTConnectionHandler, CNetStorageHandler, CNetScheduleHandler, and CBDBEnvKeeperConnectionHandler.

◆ OnOverflow() [1/3]

virtual void CServer_Connection::OnOverflow ( EOverflowReason  reason)
inlinevirtual

◆ OnOverflow() [2/3]

virtual void IServer_ConnectionBase::OnOverflow ( EOverflowReason  )
inlinevirtual

Reimplemented in CServer_Connection.

Definition at line 76 of file server_connection.hpp.

◆ OnOverflow() [3/3]

virtual void IServer_ConnectionHandler::OnOverflow ( EOverflowReason  )
inlinevirtual

Runs when there are insufficient resources to queue a connection, prior to closing it.

Provides a reason why the connection is being close, which can be reported back to the client.

Reimplemented in CNetStorageHandler, and CNetScheduleHandler.

Definition at line 288 of file server.hpp.

◆ OnRead() [1/2]

void IServer_MessageHandler::OnRead ( void  )
virtual

◆ OnRead() [2/2]

virtual void IServer_ConnectionHandler::OnRead ( void  )
pure virtual

The client has just sent data.

Implemented in CNetStorageHandler, and IServer_MessageHandler.

◆ OnSocketEvent()

void CServer_Connection::OnSocketEvent ( EServIO_Event  event)

◆ OnTimeout() [1/3]

virtual void IServer_ConnectionBase::OnTimeout ( void  )
inlinevirtual

Reimplemented in CServer_Connection.

Definition at line 74 of file server_connection.hpp.

◆ OnTimeout() [2/3]

virtual void CServer_Connection::OnTimeout ( void  )
inlinevirtual

Reimplemented from IServer_ConnectionBase.

Definition at line 101 of file server_connection.hpp.

References CServer_Connection::m_Handler.

Referenced by CServer_Connection::OnSocketEvent().

◆ OnTimeout() [3/3]

virtual void IServer_ConnectionHandler::OnTimeout ( void  )
inlinevirtual

Runs when a client has been idle for too long, prior to closing the connection [synchronous].

Reimplemented in CNetStorageHandler, and CNetScheduleHandler.

Definition at line 278 of file server.hpp.

Referenced by IServer_MessageHandler::OnRead().

◆ OnTimer() [1/2]

virtual void IServer_ConnectionBase::OnTimer ( void  )
inlinevirtual

Definition at line 75 of file server_connection.hpp.

◆ OnTimer() [2/2]

virtual void IServer_ConnectionHandler::OnTimer ( void  )
inlinevirtual

This method is called at the moment in time specified earlier by the alarm_time parameter of the GetEventsToPollFor method [synchronous].

Definition at line 282 of file server.hpp.

◆ OnWrite()

virtual void IServer_ConnectionHandler::OnWrite ( void  )
pure virtual

The client is ready to receive data.

Implemented in CNetStorageHandler, CNetScheduleHandler, CBDBEnvKeeperConnectionHandler, and CWNCTConnectionHandler.

◆ operator=()

CServer_Monitor& CServer_Monitor::operator= ( const CServer_Monitor )
private

◆ Passivate() [1/2]

virtual void IServer_ConnectionBase::Passivate ( void  )
inlinevirtual

Reimplemented in CServer_Listener.

Definition at line 78 of file server_connection.hpp.

◆ Passivate() [2/2]

virtual void CServer_Listener::Passivate ( void  )
inlinevirtual

Reimplemented from IServer_ConnectionBase.

Definition at line 141 of file server_connection.hpp.

References CListeningSocket::Close().

◆ PingControlConnection()

void CServer_ConnectionPool::PingControlConnection ( void  )

◆ Process()

virtual void Process ( SOCK  sock)
pure virtual

Runs asynchronously (from a separate thread) for each request.

Implementor must take care of closing the socket when done. (Using it as the basis of a CConn_SocketStream object will do so automatically.)

Referenced by CId1ReaderBase::LoadBlob(), CId2ReaderBase::LoadBlob(), CId2ReaderBase::LoadBlobs(), and CwxNCBIApp::OnIdle().

◆ ProcessOverflow()

virtual void ProcessOverflow ( SOCK  sock)
protectedvirtual

Runs synchronously when request queue is full.

Implementor must take care of closing socket when done.

Definition at line 112 of file threaded_server.hpp.

References SOCK_Close().

◆ ProcessTimeout() [1/2]

virtual void CServer::ProcessTimeout ( void  )
inlineprotectedvirtual

Runs synchronously when no socket activity has occurred in a while (as determined by m_AcceptTimeout).

See also
m_Parameters->accept_timeout

Reimplemented in CWorkerNodeControlServer.

Definition at line 186 of file server.hpp.

Referenced by CServer::x_DoRun().

◆ ProcessTimeout() [2/2]

virtual void ProcessTimeout ( void  )
protectedvirtual

Runs synchronously when accept has timed out.

Definition at line 115 of file threaded_server.hpp.

◆ Remove()

void CServer_ConnectionPool::Remove ( TConnBase conn)

◆ RemoveConnectionFromPool()

void CServer::RemoveConnectionFromPool ( CServer_Connection conn)

Remove externally created connection from pool.

Definition at line 832 of file server.cpp.

References conn, CServer::m_ConnectionPool, and CServer_ConnectionPool::Remove().

◆ RemoveListener() [1/2]

bool CServer::RemoveListener ( unsigned short  port)

Removes a listener.

Parameters
portthe listener on the port will be removed
Returns
true if the listener has been removed, false if the server does not listen on the port.

Definition at line 612 of file server.cpp.

References CServer::m_ConnectionPool, and CServer_ConnectionPool::RemoveListener().

◆ RemoveListener() [2/2]

bool CServer_ConnectionPool::RemoveListener ( unsigned short  port)

◆ Run() [1/2]

void CServer::Run ( void  )

◆ Run() [2/2]

void Run ( void  )

◆ Send() [1/4]

void CServer_Monitor::Send ( const char *  msg,
size_t  length 
)
virtual

Send message.

Implements IServer_Monitor.

Definition at line 104 of file server_monitor.cpp.

References CServer_Monitor::SendMessage().

◆ Send() [2/4]

virtual void IServer_Monitor::Send ( const char *  msg,
size_t  length 
)
pure virtual

◆ Send() [3/4]

void CServer_Monitor::Send ( const string str)
virtual

Send message.

Implements IServer_Monitor.

Definition at line 109 of file server_monitor.cpp.

References CServer_Monitor::SendString(), and str().

◆ Send() [4/4]

virtual void IServer_Monitor::Send ( const string str)
pure virtual

Send message.

Implemented in CServer_Monitor.

◆ SendMessage()

void CServer_Monitor::SendMessage ( const char *  msg,
size_t  length 
)

◆ SendString()

void CServer_Monitor::SendString ( const string str)

◆ Server_CheckLineMessage()

int Server_CheckLineMessage ( BUF buffer,
const void *  data,
size_t  size,
bool seen_CR 
)

◆ SetAllActive() [1/2]

void CServer_ConnectionPool::SetAllActive ( const vector< CSocketAPI::SPoll > &  polls)

◆ SetAllActive() [2/2]

void CServer_ConnectionPool::SetAllActive ( const vector< IServer_ConnectionBase * > &  conns)

◆ SetConnType()

void CServer_ConnectionPool::SetConnType ( TConnBase conn,
EServerConnType  type 
)

Guard connection from out-of-order packet processing by pulling eActiveSocket's from poll vector Resets the expiration time as a bonus.

Definition at line 179 of file connection_pool.cpp.

References conn, eClosedSocket, eDeferredSocket, eInactiveSocket, ePreClosedSocket, ePreDeferredSocket, CServer_ConnectionPool::PingControlConnection(), type, and CServer_ConnectionPool::x_UpdateExpiration().

Referenced by CServerConnectionRequest::Cancel(), CServer::DeferConnectionProcessing(), CServerConnectionRequest::Process(), and CAcceptRequest::x_DoProcess().

◆ SetCustomThreadSuffix()

void CServer::SetCustomThreadSuffix ( const string suffix)
inline

Set custom suffix to use on all threads in the server's pool.

Value can be set only before call to Run(), any change of the value after call to Run() will be ignored.

Definition at line 161 of file server.hpp.

References CServer::m_ThreadSuffix, and suffix.

◆ SetMaxConnections()

void CServer_ConnectionPool::SetMaxConnections ( unsigned  max_connections)
inline

Definition at line 59 of file connection_pool.hpp.

References CServer_ConnectionPool::m_MaxConnections.

Referenced by CServer::SetParameters().

◆ SetParameters()

void CServer::SetParameters ( const SServer_Parameters new_params)

◆ SetParams()

virtual void SetParams ( )
protectedvirtual

Called at the beginning of Run, before creating thread pool.

Definition at line 121 of file threaded_server.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), CClustererApplication::x_RunBinary(), and CClustererApplication::x_RunSparse().

◆ SetSocket() [1/2]

void CServer_Monitor::SetSocket ( CSocket socket)

Pass open socket for monitor output.

The original socket is empty afterwards, ownership is handled by monitor. It activates the monitor.

Definition at line 50 of file server_monitor.cpp.

References eCopyTimeoutsFromSOCK, eCopyTimeoutsToSOCK, eNoOwnership, eTakeOwnership, CSocket::GetSOCK(), CServer_Monitor::m_Lock, CServer_Monitor::m_Sock, CSocket::Reset(), CServer_Monitor::SendString(), and CSocket::SetOwnership().

◆ SetSocket() [2/2]

void IServer_ConnectionHandler::SetSocket ( CSocket socket)
inline

Definition at line 298 of file server.hpp.

References IServer_ConnectionHandler::m_Socket.

◆ ShutdownRequested() [1/2]

virtual bool CServer::ShutdownRequested ( void  )
inlineprotectedvirtual

Runs synchronously between iterations.

Returns
whether to shut down service and return from Run.

Reimplemented in CWorkerNodeControlServer, CNetStorageServer, CNetScheduleServer, and CBDBEnvKeeperServer.

Definition at line 191 of file server.hpp.

Referenced by CServer::x_DoRun().

◆ ShutdownRequested() [2/2]

virtual bool ShutdownRequested ( void  )
protectedvirtual

Runs synchronously between iterations.

Definition at line 118 of file threaded_server.hpp.

◆ SServer_Parameters()

SServer_Parameters::SServer_Parameters ( )

Create structure with the default set of parameters.

Definition at line 852 of file server.cpp.

◆ StartListening() [1/3]

void CServer::StartListening ( void  )

Start listening before the main loop.

If called, tries to listen on all requested ports for all listeners, correcting errors by calling listeners' OnFailure

Definition at line 637 of file server.cpp.

References CServer::m_ConnectionPool, and CServer_ConnectionPool::StartListening().

Referenced by CGridControlThread::Prepare(), and CServer::Run().

◆ StartListening() [2/3]

void StartListening ( void  )

Start listening immediately, or throw an exception if it is impossible to do so.

(Does nothing if *this* object is already listening on the port.) Calling StartListening() before Run() will permit detecting port-in-use problems before the last minute. (On the other hand, clients that attempt to connect in the interim will get no response until the main loop actually starts.)

◆ StartListening() [3/3]

void CServer_ConnectionPool::StartListening ( void  )

◆ StopListening()

void CServer_ConnectionPool::StopListening ( void  )

◆ SubmitRequest()

void CServer::SubmitRequest ( const CRef< CStdRequest > &  request)

Submit request to be executed by the server thread pool.

Definition at line 805 of file server.cpp.

References CPoolOfThreads_ForServer::AcceptRequest(), CServer::m_ThreadPool, and NULL.

◆ WakeUpPollCycle()

void CServer::WakeUpPollCycle ( void  )

Force poll cycle to make another iteration.

Should be called if IsReadyToProcess() for some connection handler became true.

Definition at line 837 of file server.cpp.

References CServer::m_ConnectionPool, and CServer_ConnectionPool::PingControlConnection().

Referenced by CNetStorageHandler::x_SendAsyncMessage().

◆ x_DoRun()

void CServer::x_DoRun ( void  )
private

◆ x_UpdateExpiration()

void CServer_ConnectionPool::x_UpdateExpiration ( TConnBase conn)
private

◆ ~CServer()

CServer::~CServer ( )
virtual

◆ ~CServer_Connection()

CServer_Connection::~CServer_Connection ( )
virtual

Definition at line 567 of file server.cpp.

References eIO_Close, and CSocket::SetTimeout().

◆ ~CServer_ConnectionPool()

CServer_ConnectionPool::~CServer_ConnectionPool ( )

Definition at line 63 of file connection_pool.cpp.

References CServer_ConnectionPool::Erase().

◆ ~CServer_Monitor()

CServer_Monitor::~CServer_Monitor ( )
virtual

Definition at line 43 of file server_monitor.cpp.

References CServer_Monitor::m_Sock, and CServer_Monitor::SendString().

◆ ~CThreadedServer()

virtual ~CThreadedServer ( )
virtual

Definition at line 86 of file threaded_server.hpp.

◆ ~IServer_ConnectionBase()

virtual IServer_ConnectionBase::~IServer_ConnectionBase ( )
inlinevirtual

Definition at line 66 of file server_connection.hpp.

◆ ~IServer_ConnectionFactory()

virtual IServer_ConnectionFactory::~IServer_ConnectionFactory ( )
inlinevirtual

Definition at line 396 of file server.hpp.

◆ ~IServer_ConnectionHandler()

virtual IServer_ConnectionHandler::~IServer_ConnectionHandler ( )
inlinevirtual

Definition at line 228 of file server.hpp.

◆ ~IServer_MessageHandler()

virtual IServer_MessageHandler::~IServer_MessageHandler ( )
inlinevirtual

Definition at line 318 of file server.hpp.

References BUF_Destroy(), and IServer_MessageHandler::m_Buffer.

◆ ~IServer_Monitor()

virtual IServer_Monitor::~IServer_Monitor ( )
inlinevirtual

Definition at line 50 of file server_monitor.hpp.

Variable Documentation

◆ accept_timeout

const STimeout* SServer_Parameters::accept_timeout

◆ CThreadedServer

CThreadedServer - abstract class for network servers using thread pools.

This code maintains a pool of threads (initially m_InitThreads, but potentially as many as m_MaxThreads) to deal with incoming connections; each connection gets assigned to one of the worker threads, allowing the server to handle multiple requests in parallel while still checking for new requests.

You must define Process() to indicate what to do with each incoming connection; .../src/connect/test_threaded_server.cpp illustrates how you might do this.

Deprecated:
Use CServer instead.

Definition at line 77 of file threaded_server.hpp.

◆ expiration

CTime IServer_ConnectionBase::expiration
private

Definition at line 84 of file server_connection.hpp.

Referenced by CServer_ConnectionPool::GetPollAndTimerVec().

◆ idle_timeout

const STimeout* SServer_Parameters::idle_timeout

For how long to keep inactive non-listening sockets open (default: 10 minutes)

Definition at line 443 of file server.hpp.

Referenced by CServer::x_DoRun().

◆ init_threads

unsigned int SServer_Parameters::init_threads

◆ m_AcceptTimeout

const STimeout* m_AcceptTimeout
protected

Maximum time between exit checks.

Definition at line 129 of file threaded_server.hpp.

◆ m_Buffer

BUF IServer_MessageHandler::m_Buffer
private

◆ m_ConnectionPool

CServer_ConnectionPool* CServer::m_ConnectionPool
private

◆ m_ControlTrigger

CTrigger CServer_ConnectionPool::m_ControlTrigger
mutableprivate

◆ m_Data

TData CServer_ConnectionPool::m_Data
private

◆ m_Factory

unique_ptr<IServer_ConnectionFactory> CServer_Listener::m_Factory
private

◆ m_Handler

unique_ptr<IServer_ConnectionHandler> CServer_Connection::m_Handler
private

◆ m_InitThreads

unsigned int m_InitThreads
protected

Settings for thread pool (which is local to Run):

Number of initial threads

Definition at line 125 of file threaded_server.hpp.

◆ m_ListenerPortsToStop

vector<unsigned short> CServer_ConnectionPool::m_ListenerPortsToStop
private

◆ m_ListeningStarted

bool CServer_ConnectionPool::m_ListeningStarted
private

◆ m_Lock

CFastMutex CServer_Monitor::m_Lock
private

◆ m_LSock

CListeningSocket m_LSock
private

Listening socket.

Definition at line 136 of file threaded_server.hpp.

◆ m_MaxConnections

unsigned int CServer_ConnectionPool::m_MaxConnections
private

◆ m_MaxThreads

unsigned int m_MaxThreads
protected

Maximum simultaneous threads.

Definition at line 126 of file threaded_server.hpp.

Referenced by CPoolOfThreads< TRequest >::HasImmediateRoom(), and CPoolOfThreads< TRequest >::x_AcceptRequest().

◆ m_Mutex

CMutex CServer_ConnectionPool::m_Mutex
mutableprivate

◆ m_Open

bool CServer_Connection::m_Open
private

◆ m_Parameters

SServer_Parameters* CServer::m_Parameters
private

◆ m_Port [1/2]

unsigned short CServer_Listener::m_Port
private

Definition at line 146 of file server_connection.hpp.

Referenced by CServer_Listener::Activate(), and CServer_Listener::GetPort().

◆ m_Port [2/2]

unsigned short m_Port
private

◆ m_QueueSize

unsigned int m_QueueSize
protected

Maximum size of request queue.

Definition at line 127 of file threaded_server.hpp.

◆ m_SeenCR

bool IServer_LineMessageHandler::m_SeenCR
private

Definition at line 356 of file server.hpp.

Referenced by IServer_LineMessageHandler::CheckMessage().

◆ m_Sock

CSocket* CServer_Monitor::m_Sock
private

◆ m_Socket

CSocket* IServer_ConnectionHandler::m_Socket
private

◆ m_SpawnThreshold

unsigned int m_SpawnThreshold
protected

Controls when to spawn more threads.

Definition at line 128 of file threaded_server.hpp.

◆ m_Stream

CConn_SocketStream IServer_StreamHandler::m_Stream
private

Definition at line 372 of file server.hpp.

◆ m_TemporarilyStopListening

bool m_TemporarilyStopListening
protected

Temporarily close listener when queue fills?

Definition at line 132 of file threaded_server.hpp.

◆ m_ThreadPool

CPoolOfThreads_ForServer* CServer::m_ThreadPool
private

◆ m_ThreadSuffix

string CServer::m_ThreadSuffix
private

Definition at line 202 of file server.hpp.

Referenced by CServer::Run(), and CServer::SetCustomThreadSuffix().

◆ max_connections

unsigned int SServer_Parameters::max_connections

◆ max_threads

unsigned int SServer_Parameters::max_threads

◆ spawn_threshold

unsigned int SServer_Parameters::spawn_threshold

Controls when to spawn more threads.

Definition at line 448 of file server.hpp.

◆ temporarily_stop_listening

bool SServer_Parameters::temporarily_stop_listening

Temporarily close listener when queue fills?

Definition at line 438 of file server.hpp.

◆ type

volatile EServerConnType IServer_ConnectionBase::type
private

◆ type_lock

CFastMutex IServer_ConnectionBase::type_lock
private

Friends

◆ CAcceptRequest

friend class CAcceptRequest
friend

Definition at line 144 of file server_connection.hpp.

Referenced by CServer_Listener::CreateRequest().

◆ CNetCacheServer

friend class CNetCacheServer
friend

Definition at line 196 of file server.hpp.

◆ CServer_Connection

friend class CServer_Connection
friend

Definition at line 297 of file server.hpp.

◆ CServer_ConnectionPool

friend class CServer_ConnectionPool
friend

Definition at line 81 of file server_connection.hpp.

◆ IServer_MessageHandler

friend class IServer_MessageHandler
friend

Definition at line 82 of file server_connection.hpp.

Modified on Wed Feb 21 09:58:15 2024 by modify_doxy.py rev. 669887