Kea 3.1.7
isc::tcp::TcpClientImpl Class Reference

TcpClient implementation. More...

Public Member Functions

 TcpClientImpl (const IOServicePtr &io_service, size_t thread_pool_size=0, bool defer_thread_start=false)
 Constructor.
 ~TcpClientImpl ()
 Destructor.
void checkPermissions ()
 Check if the current thread can perform thread pool state transition.
uint16_t getThreadCount ()
 Fetches the number of threads in the pool.
asiolink::IOServicePtr getThreadIOService ()
 Fetches the internal IOService used in multi-threaded mode.
uint16_t getThreadPoolSize ()
 Fetches the maximum size of the thread pool.
bool isPaused ()
 Indicates if the thread pool is paused.
bool isRunning ()
 Indicates if the thread pool is running.
bool isStopped ()
 Indicates if the thread pool is stopped.
void pause ()
 Pauses the client's thread pool.
void resume ()
 Resumes running the client's thread pool.
void start ()
 Starts running the client's thread pool, if multi-threaded.
void stop ()
 Close all connections, and if multi-threaded, stops the client's thread pool.

Public Attributes

ConnectionPoolPtr conn_pool_
 Holds a pointer to the connection pool.

Detailed Description

TcpClient implementation.

Definition at line 1865 of file tcp_client.cc.

Constructor & Destructor Documentation

◆ TcpClientImpl()

isc::tcp::TcpClientImpl::TcpClientImpl ( const IOServicePtr & io_service,
size_t thread_pool_size = 0,
bool defer_thread_start = false )
inline

Constructor.

If single-threading:

  • Creates the connection pool passing in the caller's IOService and a maximum number of connections per address value of 1. If multi-threading:
  • Creates a private IOService
  • Creates a thread pool with the thread_pool_size threads
  • Creates the connection pool passing the private IOService and the thread_pool_size as the maximum number of connections per URL.
Parameters
io_serviceIOService that will drive connection IO in single threaded mode. (Currently ignored in multi-threaded mode)
thread_pool_sizemaximum number of concurrent threads Internally this also sets the maximum number of concurrent connections per address.
defer_thread_startWhen true, starting of the pool threads is deferred until a subsequent call to start(). In this case the pool's operational state after construction is STOPPED. Otherwise, the thread pool threads will be created and started, with the operational state being RUNNING. Applicable only when thread-pool size is greater than zero.

Definition at line 1890 of file tcp_client.cc.

References conn_pool_, isc::log::DBGLVL_TRACE_BASIC, LOG_DEBUG, isc::tcp::TCP_CLIENT_MT_STARTED, and isc::tcp::tcp_logger.

◆ ~TcpClientImpl()

isc::tcp::TcpClientImpl::~TcpClientImpl ( )
inline

Destructor.

Calls stop().

Definition at line 1918 of file tcp_client.cc.

References stop().

Here is the call graph for this function:

Member Function Documentation

◆ checkPermissions()

void isc::tcp::TcpClientImpl::checkPermissions ( )
inline

Check if the current thread can perform thread pool state transition.

Exceptions
MultiThreadingInvalidOperationif the state transition is done on any of the worker threads.

Definition at line 1927 of file tcp_client.cc.

◆ getThreadCount()

uint16_t isc::tcp::TcpClientImpl::getThreadCount ( )
inline

Fetches the number of threads in the pool.

Returns
the number of running threads.

Definition at line 2037 of file tcp_client.cc.

◆ getThreadIOService()

asiolink::IOServicePtr isc::tcp::TcpClientImpl::getThreadIOService ( )
inline

Fetches the internal IOService used in multi-threaded mode.

Returns
A pointer to the IOService, or an empty pointer when in single-threaded mode.

Definition at line 2023 of file tcp_client.cc.

◆ getThreadPoolSize()

uint16_t isc::tcp::TcpClientImpl::getThreadPoolSize ( )
inline

Fetches the maximum size of the thread pool.

Returns
the maximum size of the thread pool.

Definition at line 2030 of file tcp_client.cc.

◆ isPaused()

bool isc::tcp::TcpClientImpl::isPaused ( )
inline

Indicates if the thread pool is paused.

Returns
True if the thread pool exists and it is in the PAUSED state, false otherwise.

Definition at line 2011 of file tcp_client.cc.

◆ isRunning()

bool isc::tcp::TcpClientImpl::isRunning ( )
inline

Indicates if the thread pool is running.

Returns
True if the thread pool exists and it is in the RUNNING state, false otherwise.

Definition at line 1987 of file tcp_client.cc.

◆ isStopped()

bool isc::tcp::TcpClientImpl::isStopped ( )
inline

Indicates if the thread pool is stopped.

Returns
True if the thread pool exists and it is in the STOPPED state, false otherwise.

Definition at line 1999 of file tcp_client.cc.

◆ pause()

void isc::tcp::TcpClientImpl::pause ( )
inline

Pauses the client's thread pool.

Suspends thread pool event processing.

Exceptions
InvalidOperationif the thread pool does not exist.

Definition at line 1961 of file tcp_client.cc.

References isc_throw.

◆ resume()

void isc::tcp::TcpClientImpl::resume ( )
inline

Resumes running the client's thread pool.

Resumes thread pool event processing.

Exceptions
InvalidOperationif the thread pool does not exist.

Definition at line 1974 of file tcp_client.cc.

References isc_throw.

◆ start()

void isc::tcp::TcpClientImpl::start ( )
inline

Starts running the client's thread pool, if multi-threaded.

Definition at line 1934 of file tcp_client.cc.

◆ stop()

void isc::tcp::TcpClientImpl::stop ( )
inline

Close all connections, and if multi-threaded, stops the client's thread pool.

Definition at line 1942 of file tcp_client.cc.

References conn_pool_.

Referenced by ~TcpClientImpl().

Member Data Documentation

◆ conn_pool_

ConnectionPoolPtr isc::tcp::TcpClientImpl::conn_pool_

Holds a pointer to the connection pool.

Definition at line 2045 of file tcp_client.cc.

Referenced by TcpClientImpl(), and stop().


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