| Kea 3.0.2-git

isc::http::HttpConnectionPool Class Reference

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.

## Detailed Description

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.

## Member Function Documentation

## ◆ shutdown()

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).

Note
  if the TLS connection stalls e.g. the peer does not try I/O on it the connection has to be explicitly stopped.

Parameters

  connection | Pointer to the connection.

Definition at line 41 of file connection_pool.cc.

References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.

Here is the call graph for this function:

## ◆ start()

void isc::http::HttpConnectionPool::start | ( | const HttpConnectionPtr & | connection | ) |

Start new connection.

The connection is inserted to the pool and the HttpConnection::asyncAccept is invoked.

Parameters

  connection | Pointer to the new connection.

Definition at line 17 of file connection_pool.cc.

References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.

Here is the call graph for this function:

## ◆ stop()

void isc::http::HttpConnectionPool::stop | ( | const HttpConnectionPtr & | connection | ) |

Removes a connection from the pool and stops it.

Parameters

  connection | Pointer to the connection.

Definition at line 29 of file connection_pool.cc.

References connections_, isc::util::MultiThreadingMgr::instance(), and mutex_.

Here is the call graph for this function:

## ◆ stopAll()

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().

Here is the call graph for this function:

## ◆ stopAllInternal()

void isc::http::HttpConnectionPool::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().

## Member Data Documentation

## ◆ connections_

std::list<HttpConnectionPtr> isc::http::HttpConnectionPool::connections_
| protected

Set of connections.

Definition at line 68 of file connection_pool.h.

Referenced by shutdown(), start(), stop(), and stopAllInternal().

## ◆ mutex_

std::mutex isc::http::HttpConnectionPool::mutex_
| protected

Mutex to protect the internal state.

Definition at line 71 of file connection_pool.h.

Referenced by shutdown(), start(), stop(), and stopAll().

The documentation for this class was generated from the following files:

- connection_pool.h
- connection_pool.cc