18 #include <boost/pointer_cast.hpp>
29 CmdHttpListener::CmdHttpListener(
const IOAddress& address,
const uint16_t port,
30 const uint16_t thread_pool_size )
31 : address_(address), port_(port), thread_io_service_(), http_listener_(),
32 thread_pool_size_(thread_pool_size), thread_pool_() {
42 if (!MultiThreadingMgr::instance().getMode()) {
44 " when multi-threading is disabled");
54 thread_io_service_.reset(
new IOService());
64 http_listener_.reset(
new HttpListener(*thread_io_service_, address_, port_, tls_context, rcf,
69 thread_pool_.reset(
new HttpThreadPool(thread_io_service_, thread_pool_size_));
73 http_listener_->start();
77 .arg(thread_pool_size_)
80 }
catch (
const std::exception& ex) {
88 thread_pool_->pause();
102 if (!thread_io_service_) {
111 thread_pool_->stop();
114 http_listener_.reset();
117 thread_io_service_.reset();
127 return (thread_pool_->isRunning());
136 return (thread_pool_->isStopped());
145 return (thread_pool_->isPaused());
boost::shared_ptr< HttpResponseCreatorFactory > HttpResponseCreatorFactoryPtr
Pointer to the HttpResponseCreatorFactory.
bool isStopped()
Indicates if the thread pool is stopped.
virtual ~CmdHttpListener()
Destructor.
HTTP response creator factory for an API listener.
const isc::log::MessageID COMMAND_HTTP_LISTENER_STARTED
const isc::log::MessageID COMMAND_HTTP_LISTENER_STOPPED
void stop()
Stops the listener's thread pool.
The IOService class is a wrapper for the ASIO io_service class.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
isc::log::Logger command_logger("commands")
Command processing Logger.
A generic exception that is thrown when an unexpected error condition occurs.
bool isPaused()
Indicates if the thread pool is paused.
const isc::log::MessageID COMMAND_HTTP_LISTENER_STOPPING
constexpr long TIMEOUT_AGENT_RECEIVE_COMMAND
Timeout for the Control Agent to receive command over the RESTful interface.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool isRunning()
Indicates if the thread pool is running.
A generic exception that is thrown if a function is called in a prohibited way.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Implements a pausable pool of IOService driven threads.
constexpr long TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT
Timeout for the idle connection to be closed.
The IOAddress class represents an IP addresses (version agnostic)
void start()
Starts running the listener's thread pool.
void resume()
Resumes running the listener's thread pool.
void pause()
Pauses the listener's thread pool.
HTTP request timeout value.