;
59m_MaxConnections(max_connections), m_ListeningStarted(
false)
93 conn->expiration.AddNanoSecond(timeout->
usec* 1000);
95 conn->expiration.Clear();
101 conn->type_lock.Lock();
104 conn->type_lock.Unlock();
145 " which has already been requested for removal");
157 if(listener->
GetPort() == port) {
180 conn->type_lock.Lock();
191 conn->type = new_type;
193 conn->type_lock.Unlock();
206<<
"PingControlConnection: failed to set control trigger: " 214 conn->type_lock.Lock();
220 ") when closing the connection. Ignore and continue.");
221 conn->type_lock.Unlock();
225 conn->type_lock.Unlock();
233vector<CSocketAPI::SPoll>& polls,
234vector<IServer_ConnectionBase*>& timer_requests,
236vector<IServer_ConnectionBase*>& revived_conns,
237vector<IServer_ConnectionBase*>& to_close_conns,
238vector<IServer_ConnectionBase*>& to_delete_conns)
242revived_conns.clear();
243to_close_conns.clear();
244to_delete_conns.clear();
248 boolalarm_time_defined =
false;
271 unsigned shortport = listener->
GetPort();
273vector<unsigned short>::iterator port_it =
295to_delete_conns.push_back(conn_base);
300to_close_conns.push_back(conn_base);
310 if(alarm_time !=
NULL) {
311 if(!alarm_time_defined) {
312alarm_time_defined =
true;
314min_alarm_time = *alarm_time > current_time? alarm_time:
NULL;
315timer_requests.clear();
316timer_requests.push_back(conn_base);
317}
else if(min_alarm_time ==
NULL) {
318 if(*alarm_time <= current_time)
319timer_requests.push_back(conn_base);
320}
else if(*alarm_time <= *min_alarm_time) {
321 if(*alarm_time != *min_alarm_time) {
322min_alarm_time = *alarm_time > current_time? alarm_time
324timer_requests.clear();
326timer_requests.push_back(conn_base);
334revived_conns.push_back(conn_base);
340 if(alarm_time_defined) {
341 if(min_alarm_time ==
NULL)
342timer_timeout->
usec= timer_timeout->
sec= 0;
348timer_timeout->
usec= timer_timeout->
sec= 0;
362 ITERATE(vector<CSocketAPI::SPoll>, it, polls) {
384 ITERATE(vector<IServer_ConnectionBase*>, it, conns) {
416vector<unsigned short> ports;
427 unsigned shortport = listener->
GetPort();
432ports.push_back(listener->
GetPort());
void Release()
Manually force the resource to be released.
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
Internal header for threaded server connection pools.
static CS_CONNECTION * conn
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Critical(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const STimeout * GetTimeout(EIO_Event event) const
Get timeout for I/O in the specified direction.
EIO_Status Abort(void)
Abort socket connection.
void StartListening(void)
void CloseConnection(TConnBase *conn)
Close connection as if it was initiated by server (not by client).
std::string g_ServerConnTypeToString(enum EServerConnType conn_type)
void Erase(void)
Erase all connections.
void SetAllActive(const vector< CSocketAPI::SPoll > &polls)
unsigned int m_MaxConnections
virtual bool IsReadyToProcess(void)
CServer_ConnectionPool(unsigned max_connections)
volatile EServerConnType type
bool 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)
vector< unsigned short > GetListenerPorts(void)
Provides a list of ports on which the server is listening.
CTrigger m_ControlTrigger
~CServer_ConnectionPool()
unsigned short GetPort(void) const
bool Add(TConnBase *conn, EServerConnType type)
virtual EIO_Event GetEventsToPollFor(const CTime **) const
virtual bool IsOpen(void)
void Remove(TConnBase *conn)
void SetConnType(TConnBase *conn, EServerConnType type)
Guard connection from out-of-order packet processing by pulling eActiveSocket's from poll vector Rese...
bool RemoveListener(unsigned short port)
void OnSocketEvent(EServIO_Event event)
void x_UpdateExpiration(TConnBase *conn)
vector< unsigned short > m_ListenerPortsToStop
void PingControlConnection(void)
void Lock(void)
Acquire mutex for the current thread with no nesting checks.
void Unlock(void)
Release mutex with no owner or nesting checks.
long GetNanoSecondsAfterSecond(void) const
Get number of nanoseconds.
CTimeSpan DiffTimeSpan(const CTime &t) const
Difference in nanoseconds from specified time.
CTime GetFastLocalTime(void)
Quick and dirty getter of local time.
long GetCompleteSeconds(void) const
Get number of complete seconds.
@ eEmpty
Use "empty" time.
@ eIgnoreDaylight
Ignore daylight saving time.
unsigned int usec
microseconds (modulo 1,000,000)
const char * IO_StatusStr(EIO_Status status)
Get the text form of an enum status value.
@ eIO_Success
everything is fine, no error occurred
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
Definition of all error codes used in connect library (xconnect.lib, xconnext.lib etc).
The polling structure m_Event can be either of eIO_Open, eIO_Read, eIO_Write, eIO_ReadWrite.
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