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

Class used to test Proactor. More...

Inheritance diagram for ProactorTest:
Collaboration diagram for ProactorTest:

Protected Member Functions

void SetUp () override
 Sets up the test fixture.
 
void TearDown () override
 Tears down the test fixture.
 
void onComplete (IoOperation &op, int result) override
 method called when an operation completes.
 
void onCancel (IoOperation &op, int result) override
 method called when an operation is cancelled.
 
- Protected Member Functions inherited from join::CompletionHandler

Static Protected Attributes

static Tcp::Acceptor _acceptor
 server acceptor.
 
static Tcp::Socket _client
 client socket.
 
static Tcp::Socket _server
 server socket.
 
static std::string _host = "127.0.0.1"
 host.
 
static uint16_t _port = 5001
 port.
 
static const std::chrono::milliseconds _timeout {1000}
 timeout.
 
static Condition _cond
 condition variable.
 
static Mutex _mut
 condition mutex.
 
static IoOperation_op = nullptr
 last completed operation.
 
static IoOperation _readOp = {}
 read side operation submitted by the tests.
 
static IoOperation _writeOp = {}
 write side operation submitted by the tests.
 
static IoOperation _spareOp = {}
 spare operation for the tests submitting two operations on the same handle.
 
static IoOperation _invalidOp = {}
 operation on an invalid handle.
 
static IoOperation _resubmitOp = {}
 operation resubmitted from a handler.
 
static int _resubmits = 0
 number of resubmissions left to perform from a handler.
 
static int _resubmitted = 0
 result of the resubmission performed from a handler.
 
static int _rejected = 0
 result of the rejected resubmission performed from a handler.
 
static Proactor_handlerProactor = nullptr
 proactor driven from within a handler, if any.
 
static IoOperation_cancelTarget = nullptr
 operation cancelled from within a handler, if any.
 
static int _cancelResult = 0
 result of the cancellation performed from a handler.
 
static IoOperation_cancelled = nullptr
 last operation reported as cancelled to the handler.
 
static bool _stopFromHandler = false
 true to stop the proactor from within a handler.
 
static bool _suspendFromHandler = false
 true to suspend the completing operation from within its own handler.
 
static int _result = 0
 last operation result.
 
static int _completions = 0
 number of completions received.
 
static char _buf [256] = {}
 read buffer.
 

Additional Inherited Members

- Public Member Functions inherited from join::CompletionHandler
 CompletionHandler ()=default
 create instance.
 
 CompletionHandler (const CompletionHandler &other)=default
 copy constructor.
 
CompletionHandleroperator= (const CompletionHandler &other)=default
 copy assignment operator.
 
 CompletionHandler (CompletionHandler &&other)=default
 move constructor.
 
CompletionHandleroperator= (CompletionHandler &&other)=default
 move assignment operator.
 
virtual ~CompletionHandler ()=default
 destroy instance.
 

Detailed Description

Class used to test Proactor.

Member Function Documentation

◆ onCancel()

void ProactorTest::onCancel ( IoOperation & op,
int result )
inlineoverrideprotectedvirtual

method called when an operation is cancelled.

Parameters
opcancelled operation.
resultnegative errno.

Reimplemented from join::CompletionHandler.

◆ onComplete()

void ProactorTest::onComplete ( IoOperation & op,
int result )
inlineoverrideprotectedvirtual

method called when an operation completes.

Parameters
opcompleted operation.
resultbytes transferred or negative errno.

Reimplemented from join::CompletionHandler.

◆ SetUp()

void ProactorTest::SetUp ( )
inlineoverrideprotected

Sets up the test fixture.

◆ TearDown()

void ProactorTest::TearDown ( )
inlineoverrideprotected

Tears down the test fixture.

Member Data Documentation

◆ _acceptor

Tcp::Acceptor ProactorTest::_acceptor
staticprotected

server acceptor.

◆ _buf

char ProactorTest::_buf = {}
staticprotected

read buffer.

◆ _cancelled

IoOperation * ProactorTest::_cancelled = nullptr
staticprotected

last operation reported as cancelled to the handler.

◆ _cancelResult

int ProactorTest::_cancelResult = 0
staticprotected

result of the cancellation performed from a handler.

◆ _cancelTarget

IoOperation * ProactorTest::_cancelTarget = nullptr
staticprotected

operation cancelled from within a handler, if any.

◆ _client

Tcp::Socket ProactorTest::_client
staticprotected

client socket.

◆ _completions

int ProactorTest::_completions = 0
staticprotected

number of completions received.

◆ _cond

Condition ProactorTest::_cond
staticprotected

condition variable.

◆ _handlerProactor

Proactor * ProactorTest::_handlerProactor = nullptr
staticprotected

proactor driven from within a handler, if any.

◆ _host

std::string ProactorTest::_host = "127.0.0.1"
staticprotected

host.

◆ _invalidOp

IoOperation ProactorTest::_invalidOp = {}
staticprotected

operation on an invalid handle.

◆ _mut

Mutex ProactorTest::_mut
staticprotected

condition mutex.

◆ _op

IoOperation * ProactorTest::_op = nullptr
staticprotected

last completed operation.

◆ _port

uint16_t ProactorTest::_port = 5001
staticprotected

port.

◆ _readOp

IoOperation ProactorTest::_readOp = {}
staticprotected

read side operation submitted by the tests.

◆ _rejected

int ProactorTest::_rejected = 0
staticprotected

result of the rejected resubmission performed from a handler.

◆ _resubmitOp

IoOperation ProactorTest::_resubmitOp = {}
staticprotected

operation resubmitted from a handler.

◆ _resubmits

int ProactorTest::_resubmits = 0
staticprotected

number of resubmissions left to perform from a handler.

◆ _resubmitted

int ProactorTest::_resubmitted = 0
staticprotected

result of the resubmission performed from a handler.

◆ _result

int ProactorTest::_result = 0
staticprotected

last operation result.

◆ _server

Tcp::Socket ProactorTest::_server
staticprotected

server socket.

◆ _spareOp

IoOperation ProactorTest::_spareOp = {}
staticprotected

spare operation for the tests submitting two operations on the same handle.

◆ _stopFromHandler

bool ProactorTest::_stopFromHandler = false
staticprotected

true to stop the proactor from within a handler.

◆ _suspendFromHandler

bool ProactorTest::_suspendFromHandler = false
staticprotected

true to suspend the completing operation from within its own handler.

◆ _timeout

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

timeout.

◆ _writeOp

IoOperation ProactorTest::_writeOp = {}
staticprotected

write side operation submitted by the tests.


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