MySQL 8.0.39
Source Code Documentation
server_mock::Acceptor Class Reference

Public Types

using protocol_type = net::ip::tcp
 

Public Member Functions

 Acceptor (net::io_context &io_ctx, std::string protocol_name, WaitableMonitor< std::list< std::unique_ptr< MySQLServerMockSession > > > &client_sessions, DuktapeStatementReaderFactory &&reader_maker, TlsServerContext &tls_server_ctx, bool with_tls)
 
 ~Acceptor ()
 
stdx::expected< void, std::error_code > init (std::string address, uint16_t port)
 
void accepted (protocol_type::socket client_sock)
 
void async_run ()
 accept connections asynchronously. More...
 
bool stopped () const
 check if acceptor is stopped. More...
 
void stop ()
 stop the acceptor. More...
 

Private Member Functions

bool stopped_now ()
 mark the acceptor as stopped. More...
 

Private Attributes

net::io_contextio_ctx_
 
protocol_type::acceptor sock_ {io_ctx_}
 
DuktapeStatementReaderFactory reader_maker_
 
std::string protocol_name_
 
WaitableMonitor< std::list< std::unique_ptr< MySQLServerMockSession > > > & client_sessions_
 
protocol_type::endpoint client_ep_
 
TlsServerContexttls_server_ctx_
 
bool with_tls_ {false}
 
Monitor< bool > stopped_ {false}
 
WaitableMonitor< int > work_ {0}
 

Member Typedef Documentation

◆ protocol_type

Constructor & Destructor Documentation

◆ Acceptor()

server_mock::Acceptor::Acceptor ( net::io_context io_ctx,
std::string  protocol_name,
WaitableMonitor< std::list< std::unique_ptr< MySQLServerMockSession > > > &  client_sessions,
DuktapeStatementReaderFactory &&  reader_maker,
TlsServerContext tls_server_ctx,
bool  with_tls 
)
inline

◆ ~Acceptor()

server_mock::Acceptor::~Acceptor ( )
inline

Member Function Documentation

◆ accepted()

void server_mock::Acceptor::accepted ( protocol_type::socket  client_sock)
inline

◆ async_run()

void server_mock::Acceptor::async_run ( )
inline

accept connections asynchronously.

runs until stopped().

◆ init()

stdx::expected< void, std::error_code > server_mock::Acceptor::init ( std::string  address,
uint16_t  port 
)
inline

◆ stop()

void server_mock::Acceptor::stop ( )
inline

stop the acceptor.

◆ stopped()

bool server_mock::Acceptor::stopped ( ) const
inline

check if acceptor is stopped.

Returns
if acceptor is stopped.

◆ stopped_now()

bool server_mock::Acceptor::stopped_now ( )
inlineprivate

mark the acceptor as stopped.

Returns
whether the acceptor was marked as stopped by this call.
Return values
truemarked acceptor as "stopped" now.
falsealready stopped before.

Member Data Documentation

◆ client_ep_

protocol_type::endpoint server_mock::Acceptor::client_ep_
private

◆ client_sessions_

WaitableMonitor<std::list<std::unique_ptr<MySQLServerMockSession> > >& server_mock::Acceptor::client_sessions_
private

◆ io_ctx_

net::io_context& server_mock::Acceptor::io_ctx_
private

◆ protocol_name_

std::string server_mock::Acceptor::protocol_name_
private

◆ reader_maker_

DuktapeStatementReaderFactory server_mock::Acceptor::reader_maker_
private

◆ sock_

protocol_type::acceptor server_mock::Acceptor::sock_ {io_ctx_}
private

◆ stopped_

Monitor<bool> server_mock::Acceptor::stopped_ {false}
private

◆ tls_server_ctx_

TlsServerContext& server_mock::Acceptor::tls_server_ctx_
private

◆ with_tls_

bool server_mock::Acceptor::with_tls_ {false}
private

◆ work_

WaitableMonitor<int> server_mock::Acceptor::work_ {0}
private

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