cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
|
Class of acceptors. More...
#include <msgpack_rpc/transport/acceptor.h>
Public Types | |
using | AsioAcceptor = AsioAcceptorType |
Type of acceptors in asio library. | |
using | AsioSocket = AsioSocketType |
Type of sockets in asio library. | |
using | ConcreteAddress = ConcreteAddressType |
Type of concrete addresses. | |
using | ConnectionType = Connection<AsioSocket, ConcreteAddress> |
Type of connections. | |
Public Types inherited from msgpack_rpc::transport::IAcceptor | |
using | ConnectionCallback |
Type of callback functions called when a connection is accepted. |
Public Member Functions | |
Acceptor (const ConcreteAddress &local_address, const std::shared_ptr< executors::IExecutor > &executor, const config::MessageParserConfig &message_parser_config, std::shared_ptr< logging::Logger > logger) | |
Constructor. | |
const addresses::IAddress & | local_address () const noexcept override |
Get the address of the local endpoint. | |
void | start (ConnectionCallback on_connection) override |
Start process of this acceptor. | |
void | stop () override |
Stop this acceptor. | |
Public Member Functions inherited from msgpack_rpc::transport::IAcceptor | |
IAcceptor (const IAcceptor &)=delete | |
IAcceptor (IAcceptor &&)=delete | |
virtual | ~IAcceptor () noexcept=default |
Destructor. | |
IAcceptor & | operator= (const IAcceptor &)=delete |
IAcceptor & | operator= (IAcceptor &&)=delete |
Private Member Functions | |
void | async_accept_next () |
Asynchronously accept a connection. | |
std::shared_ptr< executors::IExecutor > | get_executor () |
Get the executor. | |
void | on_accept (const asio::error_code &error) |
Handle the result of accept operation. | |
void | stop_in_thread () |
Stop this acceptor in this thread. |
Private Attributes | |
AsioAcceptor | acceptor_ |
Acceptor. | |
std::shared_ptr< ConnectionList< ConnectionType > > | connection_list_ |
List of connections. | |
std::weak_ptr< executors::IExecutor > | executor_ |
Executor. | |
ConcreteAddress | local_address_ |
Address of the local endpoint. | |
std::string | log_name_ |
Name of the connection for logs. | |
std::shared_ptr< logging::Logger > | logger_ |
Logger. | |
config::MessageParserConfig | message_parser_config_ |
Configuration of parsers of messages. | |
ConnectionCallback | on_connection_ {} |
Callback function called when a connection is accepted. | |
std::optional< AsioSocket > | socket_ {} |
Socket to accept connections. | |
BackgroundTaskStateMachine | state_machine_ {} |
State machine. |
Additional Inherited Members | |
Protected Member Functions inherited from msgpack_rpc::transport::IAcceptor | |
IAcceptor () noexcept=default | |
Constructor. |
Class of acceptors.
Definition at line 57 of file acceptor.h.
using msgpack_rpc::transport::Acceptor< AsioAcceptorType, AsioSocketType, ConcreteAddressType >::AsioAcceptor = AsioAcceptorType |
Type of acceptors in asio library.
Definition at line 63 of file acceptor.h.
using msgpack_rpc::transport::Acceptor< AsioAcceptorType, AsioSocketType, ConcreteAddressType >::AsioSocket = AsioSocketType |
Type of sockets in asio library.
Definition at line 66 of file acceptor.h.
using msgpack_rpc::transport::Acceptor< AsioAcceptorType, AsioSocketType, ConcreteAddressType >::ConcreteAddress = ConcreteAddressType |
Type of concrete addresses.
Definition at line 69 of file acceptor.h.
using msgpack_rpc::transport::Acceptor< AsioAcceptorType, AsioSocketType, ConcreteAddressType >::ConnectionType = Connection<AsioSocket, ConcreteAddress> |
Type of connections.
Definition at line 72 of file acceptor.h.
|
inline |
Constructor.
[in] | local_address | Local address. |
[in] | executor | Executor. |
[in] | message_parser_config | Configuration of the parser of messages. |
[in] | logger | Logger. |
Definition at line 82 of file acceptor.h.
|
inlineprivate |
Asynchronously accept a connection.
Definition at line 126 of file acceptor.h.
|
inlinenodiscardprivate |
|
inlinenodiscardoverridevirtualnoexcept |
Get the address of the local endpoint.
Implements msgpack_rpc::transport::IAcceptor.
Definition at line 117 of file acceptor.h.
|
inlineprivate |
Handle the result of accept operation.
[in] | error | Error. |
Definition at line 140 of file acceptor.h.
|
inlineoverridevirtual |
Start process of this acceptor.
[in] | on_connection | Callback function called when a connection is accepted. |
Implements msgpack_rpc::transport::IAcceptor.
Definition at line 99 of file acceptor.h.
|
inlineoverridevirtual |
Stop this acceptor.
Implements msgpack_rpc::transport::IAcceptor.
Definition at line 111 of file acceptor.h.
|
inlineprivate |
Stop this acceptor in this thread.
Definition at line 168 of file acceptor.h.
|
private |
Definition at line 201 of file acceptor.h.
|
private |
List of connections.
Definition at line 228 of file acceptor.h.
|
private |
Executor.
Definition at line 207 of file acceptor.h.
|
private |
Address of the local endpoint.
Definition at line 213 of file acceptor.h.
|
private |
Name of the connection for logs.
Definition at line 219 of file acceptor.h.
|
private |
Logger.
Definition at line 222 of file acceptor.h.
|
private |
Configuration of parsers of messages.
Definition at line 216 of file acceptor.h.
|
private |
Callback function called when a connection is accepted.
Definition at line 210 of file acceptor.h.
|
private |
Socket to accept connections.
Definition at line 204 of file acceptor.h.
|
private |
State machine.
Definition at line 225 of file acceptor.h.