join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
TcpAsyncAcceptor Class Reference

Class used to test the unix asynchronous stream acceptor API. More...

Inheritance diagram for TcpAsyncAcceptor:
Collaboration diagram for TcpAsyncAcceptor:

Protected Member Functions

void SetUp () override
 Sets up the test fixture.
 

Static Protected Member Functions

static Tcp::AsyncSocket & peer ()
 get the socket receiving the accepted connections.
 
static void onReport (Tcp::Socket &&sock, const std::error_code &ec, bool more)
 report a completion to the test thread.
 
static void onAccept (Tcp::Socket &&sock, const std::error_code &ec, bool more)
 handler resubmitting an acceptation from within itself.
 
static void onSlowReport (Tcp::Socket &&sock, const std::error_code &ec, bool more)
 handler delaying its report to widen the completion window.
 
static void onAcceptAndClose (Tcp::Socket &&sock, const std::error_code &ec, bool more)
 handler closing the acceptor from within itself.
 

Static Protected Attributes

static const IpAddress _address = "::1"
 acceptor address.
 
static const uint16_t _port = 5033
 acceptor port.
 
static const std::chrono::milliseconds _timeout {1000}
 completion timeout.
 
static Mutex _mut
 condition mutex.
 
static Condition _cond
 condition variable.
 
static std::error_code _code
 last reported error.
 
static int _completions = 0
 number of completions reported.
 
static bool _more = false
 last reported multishot state.
 
static Tcp::AsyncAcceptor * _current = nullptr
 acceptor used by the resubmitting handler.
 

Detailed Description

Class used to test the unix asynchronous stream acceptor API.

Member Function Documentation

◆ onAccept()

static void TcpAsyncAcceptor::onAccept ( Tcp::Socket && sock,
const std::error_code & ec,
bool more )
inlinestaticprotected

handler resubmitting an acceptation from within itself.

Parameters
sockaccepted socket.
ecerror reported by the acceptor.
moretrue if the acceptation stays armed.

◆ onAcceptAndClose()

static void TcpAsyncAcceptor::onAcceptAndClose ( Tcp::Socket && sock,
const std::error_code & ec,
bool more )
inlinestaticprotected

handler closing the acceptor from within itself.

Parameters
sockaccepted socket.
ecerror reported by the acceptor.
moretrue if the acceptation stays armed.

◆ onReport()

static void TcpAsyncAcceptor::onReport ( Tcp::Socket && sock,
const std::error_code & ec,
bool more )
inlinestaticprotected

report a completion to the test thread.

Parameters
sockaccepted socket.
ecerror reported by the acceptor.
moretrue if the acceptation stays armed.

◆ onSlowReport()

static void TcpAsyncAcceptor::onSlowReport ( Tcp::Socket && sock,
const std::error_code & ec,
bool more )
inlinestaticprotected

handler delaying its report to widen the completion window.

Parameters
sockaccepted socket.
ecerror reported by the acceptor.
moretrue if the acceptation stays armed.

◆ peer()

static Tcp::AsyncSocket & TcpAsyncAcceptor::peer ( )
inlinestaticprotected

get the socket receiving the accepted connections.

Returns
the socket receiving the accepted connections.

◆ SetUp()

void TcpAsyncAcceptor::SetUp ( )
inlineoverrideprotected

Sets up the test fixture.

Member Data Documentation

◆ _address

const IpAddress TcpAsyncAcceptor::_address = "::1"
staticprotected

acceptor address.

◆ _code

std::error_code TcpAsyncAcceptor::_code
staticprotected

last reported error.

◆ _completions

int TcpAsyncAcceptor::_completions = 0
staticprotected

number of completions reported.

◆ _cond

Condition TcpAsyncAcceptor::_cond
staticprotected

condition variable.

◆ _current

Tcp::AsyncAcceptor * TcpAsyncAcceptor::_current = nullptr
staticprotected

acceptor used by the resubmitting handler.

◆ _more

bool TcpAsyncAcceptor::_more = false
staticprotected

last reported multishot state.

◆ _mut

Mutex TcpAsyncAcceptor::_mut
staticprotected

condition mutex.

◆ _port

const uint16_t TcpAsyncAcceptor::_port = 5033
staticprotected

acceptor port.

◆ _timeout

const std::chrono::milliseconds TcpAsyncAcceptor::_timeout {1000}
staticprotected

completion timeout.


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