JayBeams  0.1
Another project to have fun coding.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
jb::ehs::acceptor Class Reference

Create a control server for the program. More...

#include <acceptor.hpp>

Public Member Functions

 acceptor (boost::asio::io_service &io, boost::asio::ip::tcp::endpoint const &ep, std::shared_ptr< request_dispatcher > dispatcher)
 Create an acceptor a Embedded HTTP Server and start accepting connections. More...
 
boost::asio::ip::tcp::endpoint local_endpoint () const
 Return the local listening endpoint. More...
 
void shutdown ()
 Gracefully shutdown the acceptor. More...
 

Private Member Functions

void on_accept (boost::system::error_code const &ec)
 Handle a completed asynchronous accept() call. More...
 

Private Attributes

boost::asio::ip::tcp::acceptor acceptor_
 
std::shared_ptr< request_dispatcherdispatcher_
 
boost::asio::ip::tcp::socket sock_
 

Detailed Description

Create a control server for the program.

The program runs as a typical daemon, accepting HTTP requests to start new replays, stop them, and show its current status.

Definition at line 17 of file acceptor.hpp.

Constructor & Destructor Documentation

◆ acceptor()

jb::ehs::acceptor::acceptor ( boost::asio::io_service &  io,
boost::asio::ip::tcp::endpoint const &  ep,
std::shared_ptr< request_dispatcher dispatcher 
)

Create an acceptor a Embedded HTTP Server and start accepting connections.

Parameters
ioBoost.ASIO service used to demux I/O events for this acceptor.
epthe endpoint this control server listens on.
dispatcherthe object to process requests.

Definition at line 8 of file acceptor.cpp.

References acceptor_, jb::info, JB_LOG, local_endpoint(), on_accept(), and sock_.

Member Function Documentation

◆ local_endpoint()

boost::asio::ip::tcp::endpoint jb::ehs::acceptor::local_endpoint ( ) const
inline

Return the local listening endpoint.

Definition at line 32 of file acceptor.hpp.

References acceptor_, on_accept(), and shutdown().

Referenced by acceptor(), and BOOST_AUTO_TEST_CASE().

◆ on_accept()

void jb::ehs::acceptor::on_accept ( boost::system::error_code const &  ec)
private

Handle a completed asynchronous accept() call.

Definition at line 31 of file acceptor.cpp.

References acceptor_, dispatcher_, jb::info, JB_LOG, and sock_.

Referenced by acceptor(), and local_endpoint().

◆ shutdown()

void jb::ehs::acceptor::shutdown ( )

Gracefully shutdown the acceptor.

Definition at line 26 of file acceptor.cpp.

References acceptor_, jb::info, and JB_LOG.

Referenced by BOOST_AUTO_TEST_CASE(), and local_endpoint().

Member Data Documentation

◆ acceptor_

boost::asio::ip::tcp::acceptor jb::ehs::acceptor::acceptor_
private

Definition at line 46 of file acceptor.hpp.

Referenced by acceptor(), local_endpoint(), on_accept(), and shutdown().

◆ dispatcher_

std::shared_ptr<request_dispatcher> jb::ehs::acceptor::dispatcher_
private

Definition at line 47 of file acceptor.hpp.

Referenced by on_accept().

◆ sock_

boost::asio::ip::tcp::socket jb::ehs::acceptor::sock_
private

Definition at line 49 of file acceptor.hpp.

Referenced by acceptor(), and on_accept().


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