libassa
3.5.1
|
#include <Acceptor.h>
Public Member Functions | |
Acceptor (Reactor *r_) | |
Default constructor. More... | |
virtual | ~Acceptor () |
Do-nothing destructor. More... | |
virtual int | open (const Address &local_addr_) |
Initialize listener endpoint and Acceptor with Reactor. More... | |
virtual int | close (void) |
Close PEER_ACCEPTOR stream. More... | |
int | handle_read (int fd) |
Callback invoked by Reactor when new connection requests is detected. More... | |
virtual int | handle_close (int fd) |
Callback invoked by Reactor if PEER_ACCEPTOR stream went bad, or Reactor has been commanded to stop event processing. More... | |
![]() | |
EventHandler () | |
Constructor. More... | |
virtual | ~EventHandler () |
Virtual destructor. More... | |
virtual int | handle_write (int fd) |
Write handler callback. More... | |
virtual int | handle_except (int fd) |
Exception handler callback. More... | |
virtual int | handle_timeout (TimerId tid) |
Timeout handler callback. More... | |
virtual int | handle_signal (int signum_) |
Signal handler callback. More... | |
virtual void | resetState (void) |
A hook for derived class to reset internal state as needed. More... | |
void | set_id (const std::string &id_) |
Set EventHandler ID. More... | |
std::string | get_id () const |
Retrieve EventHandler ID. More... | |
Protected Member Functions | |
virtual SERVICE_HANDLER * | makeServiceHandler (PEER_ACCEPTOR *sock_) |
Defines creation strategy for ServiceHandler. More... | |
virtual int | acceptServiceHandler (PEER_ACCEPTOR *&new_socket_) |
Default strategy is to accept new connection. More... | |
virtual int | activateServiceHandler (PEER_ACCEPTOR *new_socket_) |
Defines the concurrency strategy. More... | |
Protected Attributes | |
PEER_ACCEPTOR | m_listenSocket |
Underlying communication stream. More... | |
![]() | |
std::string | m_id |
Private Attributes | |
Reactor * | m_reactor |
Reactor to use. More... | |
Definition at line 43 of file Acceptor.h.
|
inline |
Default constructor.
r_ | Reactor to use |
Definition at line 143 of file Acceptor.h.
References trace.
|
inlinevirtual |
Do-nothing destructor.
Underlying PEER_ACCEPTOR stream will be closed during its own destruction sequence.
Definition at line 152 of file Acceptor.h.
References trace.
|
inlineprotectedvirtual |
Default strategy is to accept new connection.
Derived class can change this strategy by overloading this method.
new_socket_ | On return will have a pointer to newly created PEER_STREAM, or =0 if failed |
Definition at line 197 of file Acceptor.h.
References trace.
|
protectedvirtual |
Defines the concurrency strategy.
Default is to create SERVICE_HANDLERin current process(thread), call its open() methid and let Reactor handle its I/O events. Derived class changes this strategy by overloading this class.
new_socket_ | [in] PEER_STREAM pointer to activate |
Definition at line 207 of file Acceptor.h.
|
inlinevirtual |
Close PEER_ACCEPTOR stream.
Definition at line 160 of file Acceptor.h.
References trace.
|
inlinevirtual |
Callback invoked by Reactor if PEER_ACCEPTOR stream went bad, or Reactor has been commanded to stop event processing.
This method should always return -1, if stream cannot be repared. Derived class can change this strategy by overloading this method. If called object is other then Reactor, an explicit call to Reactor::removeHandler (this->id()) is required. By default behavior, Acceptor will destroy itself.
Reimplemented from ASSA::EventHandler.
Definition at line 170 of file Acceptor.h.
References DL, ASSA::REACT, and trace.
|
virtual |
Callback invoked by Reactor when new connection requests is detected.
Default strategy is to accept ALL awaiting incoming connections at once. Derived class can change this strategy by overloading this method.
Reimplemented from ASSA::EventHandler.
Definition at line 251 of file Acceptor.h.
References PA, ASSA::FdSet::reset(), ASSA::FdSet::setFd(), and trace.
|
inlineprotectedvirtual |
Defines creation strategy for ServiceHandler.
Definition at line 187 of file Acceptor.h.
References trace.
|
virtual |
Initialize listener endpoint and Acceptor with Reactor.
Derive classes can change this strategy by overloading this method.
Definition at line 223 of file Acceptor.h.
References DL, ASSA::Address::getAddress(), ASSA::READ_EVENT, trace, and ASSA::TRACE.
|
protected |
Underlying communication stream.
Definition at line 123 of file Acceptor.h.
|
private |
Reactor to use.
Definition at line 129 of file Acceptor.h.