A pool of server sessions. More...
#include <HttpSessionManager.h>
Inherits Continuation.
Data Structures | |
struct | HostHashing |
Interface class for FQDN map. More... | |
struct | IPHashing |
Interface class for IP map. More... | |
Public Member Functions | |
ServerSessionPool () | |
Default constructor. | |
int | eventHandler (int event, void *data) |
Handle events from server sessions. | |
HttpServerSession * | acquireSession (sockaddr const *addr, INK_MD5 const &host_hash, TSServerSessionSharingMatchType match_style) |
Get a session from the pool. | |
void | releaseSession (HttpServerSession *ss) |
Release a session to to pool. | |
void | purge () |
Close all sessions and then clear the table. | |
Static Public Member Functions | |
static bool | match (HttpServerSession *ss, sockaddr const *addr, INK_MD5 const &host_hash, TSServerSessionSharingMatchType match_style) |
Check if a session matches address and host name. | |
Data Fields | |
IPHashTable | m_ip_pool |
HostHashTable | m_host_pool |
Protected Types | |
typedef TSHashTable< IPHashing > | IPHashTable |
Sessions by IP address. | |
typedef TSHashTable< HostHashing > | HostHashTable |
Sessions by host name. |
A pool of server sessions.
This is a continuation so that it can get callbacks from the server sessions. This is used to track remote closes on the sessions so they can be cleaned up.
Definition at line 56 of file HttpSessionManager.h.
typedef TSHashTable<HostHashing> ServerSessionPool::HostHashTable [protected] |
Sessions by host name.
Definition at line 92 of file HttpSessionManager.h.
typedef TSHashTable<IPHashing> ServerSessionPool::IPHashTable [protected] |
Sessions by IP address.
Definition at line 91 of file HttpSessionManager.h.
ServerSessionPool::ServerSessionPool | ( | ) |
Default constructor.
Constructs an empty pool.
Definition at line 48 of file HttpSessionManager.cc.
References eventHandler(), m_host_pool, m_ip_pool, TSHashTable< HostHashing >::MANUAL, TSHashTable< IPHashing >::MANUAL, SET_HANDLER, and TSHashTable< H >::setExpansionPolicy().
HttpServerSession * ServerSessionPool::acquireSession | ( | sockaddr const * | addr, | |
INK_MD5 const & | host_hash, | |||
TSServerSessionSharingMatchType | match_style | |||
) |
Get a session from the pool.
The session is selected based on match_style equivalently to match. If found the session is removed from the pool.
NULL
if not matching session was found. Definition at line 78 of file HttpSessionManager.cc.
References ats_ip_port_cast(), TSHashTable< H >::find(), m_host_pool, m_ip_pool, TSHashTable< H >::remove(), TS_SERVER_SESSION_SHARING_MATCH_HOST, TS_SERVER_SESSION_SHARING_MATCH_IP, and TS_SERVER_SESSION_SHARING_MATCH_NONE.
Referenced by HttpSessionManager::acquire_session().
int ServerSessionPool::eventHandler | ( | int | event, | |
void * | data | |||
) |
Handle events from server sessions.
Definition at line 137 of file HttpSessionManager.cc.
References HttpConfig::acquire(), HttpServerSession::con_id, HttpServerSession::connection_count, Debug, HttpServerSession::do_io_close(), HttpServerSession::enable_origin_connection_limiting, TSHashTable< H >::find(), NetVConnection::get_active_timeout(), HttpDebugNames::get_event_name(), NetVConnection::get_inactivity_timeout(), HttpServerSession::get_netvc(), NetVConnection::get_remote_addr(), ConnectionCount::getCount(), HSS_KA_SHARED, ink_assert, ink_release_assert, m_host_pool, m_ip_pool, HttpConfigParams::origin_min_keep_alive_connections, HttpConfig::release(), TSHashTable< H >::remove(), HttpServerSession::server_ip, NetVConnection::set_active_timeout(), NetVConnection::set_inactivity_timeout(), HttpServerSession::state, VC_EVENT_ACTIVE_TIMEOUT, VC_EVENT_EOS, VC_EVENT_ERROR, VC_EVENT_INACTIVITY_TIMEOUT, VC_EVENT_READ_READY, and Warning.
Referenced by ServerSessionPool().
bool ServerSessionPool::match | ( | HttpServerSession * | ss, | |
sockaddr const * | addr, | |||
INK_MD5 const & | host_hash, | |||
TSServerSessionSharingMatchType | match_style | |||
) | [static] |
Check if a session matches address and host name.
Definition at line 67 of file HttpSessionManager.cc.
References ats_ip_addr_port_eq(), ats_ip_port_cast(), HttpServerSession::hostname_hash, HttpServerSession::server_ip, TS_SERVER_SESSION_SHARING_MATCH_HOST, TS_SERVER_SESSION_SHARING_MATCH_IP, and TS_SERVER_SESSION_SHARING_MATCH_NONE.
Referenced by HttpSessionManager::acquire_session().
void ServerSessionPool::purge | ( | ) |
Close all sessions and then clear the table.
Definition at line 57 of file HttpSessionManager.cc.
References TSHashTable< H >::begin(), TSHashTable< H >::clear(), TSHashTable< H >::end(), m_host_pool, and m_ip_pool.
Referenced by HttpSessionManager::purge_keepalives().
void ServerSessionPool::releaseSession | ( | HttpServerSession * | ss | ) |
Release a session to to pool.
Definition at line 111 of file HttpSessionManager.cc.
References HttpServerSession::con_id, Debug, HttpServerSession::do_io_read(), HttpServerSession::do_io_write(), NetVConnection::get_active_timeout(), NetVConnection::get_inactivity_timeout(), HttpServerSession::get_netvc(), TSHashTable< H >::insert(), INT64_MAX, m_host_pool, m_ip_pool, HttpServerSession::read_buffer, NetVConnection::set_active_timeout(), NetVConnection::set_inactivity_timeout(), and HttpServerSession::state.
Referenced by HttpSessionManager::release_session().
Definition at line 117 of file HttpSessionManager.h.
Referenced by acquireSession(), eventHandler(), purge(), releaseSession(), and ServerSessionPool().
Definition at line 116 of file HttpSessionManager.h.
Referenced by acquireSession(), eventHandler(), purge(), releaseSession(), and ServerSessionPool().