Defines the interface for specifying a passive connection acceptance strategy for a SVC_HANDLER. More...
#include <Strategies_T.h>

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_Accept_Strategy (ACE_Reactor *reactor=ACE_Reactor::instance()) | |
| Default constructor. | |
| ACE_Accept_Strategy (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool restart=false, ACE_Reactor *reactor=ACE_Reactor::instance()) | |
Initialize the peer_acceptor_ with local_addr. | |
| virtual int | open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool reuse_addr=false) |
| virtual ACE_HANDLE | get_handle (void) const |
| Return the underlying ACE_HANDLE of the <peer_acceptor_>. | |
| virtual ACE_PEER_ACCEPTOR & | acceptor (void) const |
| Return a reference to the <peer_acceptor_>. | |
| virtual | ~ACE_Accept_Strategy (void) |
| virtual int | accept_svc_handler (SVC_HANDLER *) |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Attributes | |
| ACE_PEER_ACCEPTOR | peer_acceptor_ |
| Factory that establishes connections passively. | |
| ACE_Reactor * | reactor_ |
| Pointer to the reactor used by the Acceptor. | |
| bool | reuse_addr_ |
| Needed to reopen the socket if <accept> fails. | |
| ACE_PEER_ACCEPTOR_ADDR | peer_acceptor_addr_ |
| Needed to reopen the socket if <accept> fails. | |
Defines the interface for specifying a passive connection acceptance strategy for a SVC_HANDLER.
This class provides a strategy that manages passive connection acceptance of a client.
Definition at line 498 of file Strategies_T.h.
| typedef ACE_PEER_ACCEPTOR ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor_type |
Definition at line 504 of file Strategies_T.h.
| typedef ACE_PEER_ACCEPTOR_ADDR ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::addr_type |
Definition at line 503 of file Strategies_T.h.
| typedef SVC_HANDLER ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handler_type |
Definition at line 505 of file Strategies_T.h.
| typedef SVC_HANDLER::stream_type ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::stream_type |
Definition at line 506 of file Strategies_T.h.
| ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Accept_Strategy | ( | ACE_Reactor * | reactor = ACE_Reactor::instance () |
) | [inline] |
Default constructor.
Definition at line 124 of file Strategies_T.inl.
| ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Accept_Strategy | ( | const ACE_PEER_ACCEPTOR_ADDR & | local_addr, | |
| bool | restart = false, |
|||
| ACE_Reactor * | reactor = ACE_Reactor::instance () | |||
| ) | [inline] |
Initialize the peer_acceptor_ with local_addr.
Definition at line 323 of file Strategies_T.cpp.
| ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::~ACE_Accept_Strategy | ( | void | ) | [inline, virtual] |
Definition at line 1289 of file Strategies_T.cpp.
01290 { 01291 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy"); 01292 01293 // Close the underlying acceptor. 01294 this->peer_acceptor_.close (); 01295 }
| int ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::accept_svc_handler | ( | SVC_HANDLER * | svc_handler | ) | [inline, virtual] |
The default behavior delegates to the <accept> method of the PEER_ACCEPTOR.
Definition at line 338 of file Strategies_T.cpp.
00339 { 00340 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler"); 00341 00342 // Try to find out if the implementation of the reactor that we are 00343 // using requires us to reset the event association for the newly 00344 // created handle. This is because the newly created handle will 00345 // inherit the properties of the listen handle, including its event 00346 // associations. 00347 bool reset_new_handle = this->reactor_->uses_event_associations (); 00348 00349 if (this->peer_acceptor_.accept (svc_handler->peer (), // stream 00350 0, // remote address 00351 0, // timeout 00352 1, // restart 00353 reset_new_handle // reset new handler 00354 ) == -1) 00355 { 00356 // Ensure that errno is preserved in case the svc_handler 00357 // close() method resets it 00358 ACE_Errno_Guard error(errno); 00359 00360 // Close down handler to avoid memory leaks. 00361 svc_handler->close (CLOSE_DURING_NEW_CONNECTION); 00362 00363 return -1; 00364 } 00365 else 00366 return 0; 00367 }
| ACE_PEER_ACCEPTOR & ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor | ( | void | ) | const [inline, virtual] |
Return a reference to the <peer_acceptor_>.
Definition at line 1305 of file Strategies_T.cpp.
01306 { 01307 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor"); 01308 return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; 01309 }
| void ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::dump | ( | void | ) | const [inline] |
Dump the state of an object.
Definition at line 1312 of file Strategies_T.cpp.
01313 { 01314 #if defined (ACE_HAS_DUMP) 01315 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump"); 01316 #endif /* ACE_HAS_DUMP */ 01317 }
| ACE_HANDLE ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::get_handle | ( | void | ) | const [inline, virtual] |
Return the underlying ACE_HANDLE of the <peer_acceptor_>.
Definition at line 1298 of file Strategies_T.cpp.
01299 { 01300 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle"); 01301 return this->peer_acceptor_.get_handle (); 01302 }
| int ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::open | ( | const ACE_PEER_ACCEPTOR_ADDR & | local_addr, | |
| bool | reuse_addr = false | |||
| ) | [inline, virtual] |
Initialize the <peer_acceptor_> with local_addr, indicating whether to reuse_addr if it's already in use.
Definition at line 304 of file Strategies_T.cpp.
00305 { 00306 this->reuse_addr_ = reuse_addr; 00307 this->peer_acceptor_addr_ = local_addr; 00308 if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) 00309 return -1; 00310 00311 // Set the peer acceptor's handle into non-blocking mode. This is a 00312 // safe-guard against the race condition that can otherwise occur 00313 // between the time when <select> indicates that a passive-mode 00314 // socket handle is "ready" and when we call <accept>. During this 00315 // interval, the client can shutdown the connection, in which case, 00316 // the <accept> call can hang! 00317 this->peer_acceptor_.enable (ACE_NONBLOCK); 00318 return 0; 00319 }
| ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
Definition at line 539 of file Strategies_T.h.
ACE_PEER_ACCEPTOR ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::peer_acceptor_ [protected] |
Factory that establishes connections passively.
Definition at line 543 of file Strategies_T.h.
ACE_PEER_ACCEPTOR_ADDR ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::peer_acceptor_addr_ [protected] |
Needed to reopen the socket if <accept> fails.
Definition at line 552 of file Strategies_T.h.
ACE_Reactor* ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::reactor_ [protected] |
Pointer to the reactor used by the Acceptor.
Definition at line 546 of file Strategies_T.h.
bool ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::reuse_addr_ [protected] |
Needed to reopen the socket if <accept> fails.
Definition at line 549 of file Strategies_T.h.
1.6.1