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

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

Inheritance diagram for UnixAsyncAcceptor:
Collaboration diagram for UnixAsyncAcceptor:

Protected Member Functions

void SetUp () override
 Sets up the test fixture.
 

Static Protected Member Functions

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

Static Protected Attributes

static const std::string _path = "/tmp/unixasyncacceptor_test.sock"
 acceptor path.
 
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 UnixStream::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 UnixAsyncAcceptor::onAccept ( UnixStream::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 UnixAsyncAcceptor::onAcceptAndClose ( UnixStream::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 UnixAsyncAcceptor::onReport ( UnixStream::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 UnixAsyncAcceptor::onSlowReport ( UnixStream::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 UnixStream::AsyncSocket & UnixAsyncAcceptor::peer ( )
inlinestaticprotected

get the socket receiving the accepted connections.

Returns
the socket receiving the accepted connections.

◆ SetUp()

void UnixAsyncAcceptor::SetUp ( )
inlineoverrideprotected

Sets up the test fixture.

◆ TearDownTestSuite()

static void UnixAsyncAcceptor::TearDownTestSuite ( )
inlinestaticprotected

Tears down the test suite.

Member Data Documentation

◆ _code

std::error_code UnixAsyncAcceptor::_code
staticprotected

last reported error.

◆ _completions

int UnixAsyncAcceptor::_completions = 0
staticprotected

number of completions reported.

◆ _cond

Condition UnixAsyncAcceptor::_cond
staticprotected

condition variable.

◆ _current

UnixStream::AsyncAcceptor * UnixAsyncAcceptor::_current = nullptr
staticprotected

acceptor used by the resubmitting handler.

◆ _more

bool UnixAsyncAcceptor::_more = false
staticprotected

last reported multishot state.

◆ _mut

Mutex UnixAsyncAcceptor::_mut
staticprotected

condition mutex.

◆ _path

const std::string UnixAsyncAcceptor::_path = "/tmp/unixasyncacceptor_test.sock"
staticprotected

acceptor path.

◆ _timeout

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

completion timeout.


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