Generic factory for passively connecting clients and creating exactly one service handler of the type SVC_HANDLER specified in the template.
More...
Public Types |
typedef ACE_PEER_ACCEPTOR_ADDR | addr_type |
typedef ACE_PEER_ACCEPTOR | acceptor_type |
typedef SVC_HANDLER | handler_type |
typedef SVC_HANDLER::stream_type | stream_type |
Public Member Functions |
| ACE_Oneshot_Acceptor (void) |
| Constructor.
|
| ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *reactor=ACE_Reactor::instance(), ACE_Concurrency_Strategy< SVC_HANDLER > *=0) |
int | open (const ACE_PEER_ACCEPTOR_ADDR &, ACE_Reactor *reactor=ACE_Reactor::instance(), ACE_Concurrency_Strategy< SVC_HANDLER > *=0) |
virtual | ~ACE_Oneshot_Acceptor (void) |
| Close down the {Oneshot_Acceptor}.
|
virtual int | accept (SVC_HANDLER *=0, ACE_PEER_ACCEPTOR_ADDR *remote_addr=0, const ACE_Synch_Options &synch_options=ACE_Synch_Options::defaults, bool restart=true, bool reset_new_handle=false) |
virtual int | cancel (void) |
| Cancel a oneshot acceptor that was started asynchronously.
|
virtual | operator ACE_PEER_ACCEPTOR & () const |
| Return the underlying {PEER_ACCEPTOR} object.
|
virtual ACE_PEER_ACCEPTOR & | acceptor (void) const |
| Return the underlying {PEER_ACCEPTOR} object.
|
virtual int | close (void) |
| Close down the {Oneshot_Acceptor}.
|
void | dump (void) const |
| Dump the state of an object.
|
Public Attributes |
| ACE_ALLOC_HOOK_DECLARE |
| Declare the dynamic allocation hooks.
|
Protected Member Functions |
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler) |
int | shared_accept (SVC_HANDLER *svc_handler, ACE_PEER_ACCEPTOR_ADDR *remote_addr, ACE_Time_Value *timeout, bool restart, bool reset_new_handle) |
virtual ACE_HANDLE | get_handle (void) const |
| Returns the listening acceptor's {ACE_HANDLE}.
|
virtual int | handle_close (ACE_HANDLE=ACE_INVALID_HANDLE, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
virtual int | handle_input (ACE_HANDLE) |
virtual int | handle_timeout (const ACE_Time_Value &tv, const void *arg) |
| Called when an acceptor times out...
|
virtual int | init (int argc, ACE_TCHAR *argv[]) |
virtual int | fini (void) |
virtual int | info (ACE_TCHAR **, size_t) const |
| Default version returns address info in {buf}.
|
virtual int | suspend (void) |
virtual int | resume (void) |
Private Member Functions |
int | register_handler (SVC_HANDLER *svc_handler, const ACE_Synch_Options &options, bool restart) |
Private Attributes |
SVC_HANDLER * | svc_handler_ |
| Hold the svc_handler_ across asynchrony boundaries.
|
bool | restart_ |
| Hold the restart flag across asynchrony boundaries.
|
ACE_PEER_ACCEPTOR | peer_acceptor_ |
| Factory that establishes connections passively.
|
ACE_Concurrency_Strategy
< SVC_HANDLER > * | concurrency_strategy_ |
| Concurrency strategy for an Acceptor.
|
bool | delete_concurrency_strategy_ |
template<class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >
Generic factory for passively connecting clients and creating exactly one service handler of the type SVC_HANDLER specified in the template.
This class works similarly to the regular ACE_Acceptor, but with the following differences:
- ACE_Oneshot_Acceptor doesn't automatically register itself with the ACE_Reactor; the caller is expected to call the accept() method directly. Since a later call to accept() may require a reactor, the constructor and open() methods both accept an ACE_Reactor pointer which is saved in case it's needed in accept().
- ACE_Oneshot_Acceptor doesn't need an ACE_Creation_Strategy (because the user supplies the SVC_HANDLER) or an ACE_Accept_Strategy (because this class only accepts one connection and then removes all traces of itself from the ACE_Reactor if it was registered for asynchronous accepts).
The usage model for ACE_Oneshot_Acceptor is:
- Instantiate an object and establish its local address to listen at. This can be accomplished using either the address-accepting constructor (but there's no error indication) or the default constructor followed by a call to open().
- Call the accept() method. This will attempt to accept a connection immediately. If there is no immediately available connection to accept, behavior is governed by the ACE_Synch_Options argument passed to open().