Kea 2.7.6
|
Pool of active HTTP connections. More...
#include <connection_pool.h>
Public Member Functions | |
void | shutdown (const HttpConnectionPtr &connection) |
Removes a connection from the pool and shutdown it. | |
void | start (const HttpConnectionPtr &connection) |
Start new connection. | |
void | stop (const HttpConnectionPtr &connection) |
Removes a connection from the pool and stops it. | |
void | stopAll () |
Stops all connections and removes them from the pool. | |
Protected Member Functions | |
void | stopAllInternal () |
Stops all connections and removes them from the pool. | |
Protected Attributes | |
std::list< HttpConnectionPtr > | connections_ |
Set of connections. | |
std::mutex | mutex_ |
Mutex to protect the internal state. | |
Pool of active HTTP connections.
The HTTP server is designed to handle many connections simultaneously. The communication between the client and the server may take long time and the server must be able to react on other events while the communication with the clients is in progress. Thus, the server must track active connections and gracefully close them when needed. An obvious case when the connections must be terminated by the server is when the shutdown signal is received.
This object is a simple container for the server connections which provides means to terminate them on request.
Definition at line 30 of file connection_pool.h.
void isc::http::HttpConnectionPool::shutdown | ( | const HttpConnectionPtr & | connection | ) |
Removes a connection from the pool and shutdown it.
Shutdown is specific to TLS and is a first part of graceful close (note it is NOT the same as TCP shutdown system call).
connection | Pointer to the connection. |
Definition at line 41 of file connection_pool.cc.
References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.
void isc::http::HttpConnectionPool::start | ( | const HttpConnectionPtr & | connection | ) |
Start new connection.
The connection is inserted to the pool and the HttpConnection::asyncAccept is invoked.
connection | Pointer to the new connection. |
Definition at line 17 of file connection_pool.cc.
References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.
void isc::http::HttpConnectionPool::stop | ( | const HttpConnectionPtr & | connection | ) |
Removes a connection from the pool and stops it.
connection | Pointer to the connection. |
Definition at line 29 of file connection_pool.cc.
References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.
void isc::http::HttpConnectionPool::stopAll | ( | ) |
Stops all connections and removes them from the pool.
Definition at line 53 of file connection_pool.cc.
References isc::util::MultiThreadingMgr::instance(), mutex_, and stopAllInternal().
|
protected |
Stops all connections and removes them from the pool.
Must be called from with a thread-safe context.
Definition at line 63 of file connection_pool.cc.
References connections_.
Referenced by stopAll().
|
protected |
Set of connections.
Definition at line 68 of file connection_pool.h.
Referenced by shutdown(), start(), stop(), and stopAllInternal().
|
protected |
Mutex to protect the internal state.
Definition at line 71 of file connection_pool.h.
Referenced by shutdown(), start(), stop(), and stopAll().