#include <Acceptor.h>
Inheritance diagram for ACE_Oneshot_Acceptor< SVC_HANDLER, >:
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, int restart=1, int reset_new_handle=0) |
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, int restart, int 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, int restart) |
Private Attributes | |
SVC_HANDLER * | svc_handler_ |
Hold the svc_handler_ across asynchrony boundaries. | |
int | 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_ |
This class works similarly to the regular {ACE_Acceptor}, with the following differences: 1. This class doesn't automagically register {this} with the {ACE_Reactor} since it expects to have its {accept} method called directly. However, it stashes the {ACE_Reactor} pointer away in case it's needed later to finish accepting a connection asynchronously. 2. The class doesn't need an {ACE_Creation_Strategy} (since the user supplies the SVC_HANDLER) or an {ACE_Accept_Strategy} (since this class only accepts one connection and then removes all traces of itself from the {ACE_Reactor} if it was registered for asynchronous accepts).
Definition at line 525 of file Acceptor.h.
typedef ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, >::acceptor_type |
Definition at line 531 of file Acceptor.h.
typedef ACE_PEER_ACCEPTOR_ADDR ACE_Oneshot_Acceptor< SVC_HANDLER, >::addr_type |
Definition at line 530 of file Acceptor.h.
typedef SVC_HANDLER ACE_Oneshot_Acceptor< SVC_HANDLER, >::handler_type |
Definition at line 532 of file Acceptor.h.
typedef SVC_HANDLER::stream_type ACE_Oneshot_Acceptor< SVC_HANDLER, >::stream_type |
Definition at line 533 of file Acceptor.h.
ACE_Oneshot_Acceptor< SVC_HANDLER, >::ACE_Oneshot_Acceptor | ( | void | ) |
Constructor.
Definition at line 892 of file Acceptor.cpp.
References ACE_TRACE, and ACE_Event_Handler::reactor().
00893 : delete_concurrency_strategy_ (false) 00894 { 00895 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor"); 00896 this->reactor (0); 00897 }
ACE_Oneshot_Acceptor< SVC_HANDLER, >::ACE_Oneshot_Acceptor | ( | const ACE_PEER_ACCEPTOR_ADDR & | local_addr, | |
ACE_Reactor * | reactor = ACE_Reactor::instance() , |
|||
ACE_Concurrency_Strategy< SVC_HANDLER > * | = 0 | |||
) |
Initialize the appropriate strategies for concurrency and then open the {peer_acceptor} at the designated {local_addr}. Note that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this method does NOT register {this} acceptor with the {reactor} at this point -- it just stashes the {reactor} away in case it's needed later.
Definition at line 901 of file Acceptor.cpp.
References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.
00904 : delete_concurrency_strategy_ (false) 00905 { 00906 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor"); 00907 if (this->open (local_addr, reactor, cs) == -1) 00908 ACE_ERROR ((LM_ERROR, 00909 ACE_TEXT ("%p\n"), 00910 ACE_TEXT ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"))); 00911 }
ACE_Oneshot_Acceptor< SVC_HANDLER, >::~ACE_Oneshot_Acceptor | ( | void | ) | [virtual] |
Close down the {Oneshot_Acceptor}.
Definition at line 914 of file Acceptor.cpp.
References ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close().
00915 { 00916 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Oneshot_Acceptor"); 00917 this->handle_close (); 00918 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::accept | ( | SVC_HANDLER * | = 0 , |
|
ACE_PEER_ACCEPTOR_ADDR * | remote_addr = 0 , |
|||
const ACE_Synch_Options & | synch_options = ACE_Synch_Options::defaults , |
|||
int | restart = 1 , |
|||
int | reset_new_handle = 0 | |||
) | [virtual] |
Create a {SVC_HANDLER}, accept the connection into the {SVC_HANDLER}, and activate the {SVC_HANDLER}.
Definition at line 1072 of file Acceptor.cpp.
References ACE_TRACE, ACE_Synch_Options::time_value(), ACE_Synch_Options::USE_REACTOR, and ACE_Time_Value::zero.
01077 { 01078 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept"); 01079 // Note that if timeout == ACE_Time_Value (x, y) where (x > 0 || y > 01080 // 0) then this->connector_.connect() will block synchronously. If 01081 // <use_reactor> is set then we don't want this to happen (since we 01082 // want the ACE_Reactor to do the timeout asynchronously). 01083 // Therefore, we'll force this->connector_ to use ACE_Time_Value (0, 01084 // 0) in this case... 01085 01086 ACE_Time_Value *timeout; 01087 int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; 01088 01089 if (use_reactor) 01090 timeout = (ACE_Time_Value *) &ACE_Time_Value::zero; 01091 else 01092 timeout = (ACE_Time_Value *) synch_options.time_value (); 01093 01094 if (this->shared_accept (svc_handler, // stream 01095 remote_addr, // remote address 01096 timeout, // timeout 01097 restart, // restart 01098 reset_new_handle // reset new handler 01099 ) == -1) 01100 { 01101 if (use_reactor && errno == EWOULDBLOCK) 01102 // We couldn't accept right away, so let's wait in the 01103 // <ACE_Reactor>. 01104 this->register_handler (svc_handler, 01105 synch_options, 01106 restart); 01107 return -1; 01108 } 01109 return 0; 01110 }
ACE_PEER_ACCEPTOR & ACE_Oneshot_Acceptor< SVC_HANDLER, >::acceptor | ( | void | ) | const [virtual] |
Return the underlying {PEER_ACCEPTOR} object.
Definition at line 1218 of file Acceptor.cpp.
References ACE_PEER_ACCEPTOR, ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::peer_acceptor_.
01219 { 01220 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor"); 01221 return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; 01222 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::activate_svc_handler | ( | SVC_HANDLER * | svc_handler | ) | [protected, virtual] |
Bridge method for activating a {svc_handler} with the appropriate concurrency strategy. Default behavior is to activate the {SVC_HANDLER} as a "passive object." However, subclasses can override this strategy to do more sophisticated concurrency activations (such as creating the {SVC_HANDLER} as an "active object" via multi-threading or multi-processing).
Definition at line 1022 of file Acceptor.cpp.
References ACE_TRACE.
01023 { 01024 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler"); 01025 return this->concurrency_strategy_->activate_svc_handler 01026 (svc_handler, 01027 (void *) this); 01028 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::cancel | ( | void | ) | [virtual] |
Cancel a oneshot acceptor that was started asynchronously.
Definition at line 975 of file Acceptor.cpp.
References ACE_TRACE, ACE_Reactor::cancel_timer(), and ACE_Event_Handler::reactor().
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_input().
00976 { 00977 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::cancel"); 00978 return this->reactor () && this->reactor ()->cancel_timer (this); 00979 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::close | ( | void | ) | [virtual] |
Close down the {Oneshot_Acceptor}.
Definition at line 921 of file Acceptor.cpp.
References ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close().
00922 { 00923 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::close"); 00924 return this->handle_close (); 00925 }
void ACE_Oneshot_Acceptor< SVC_HANDLER, >::dump | ( | void | ) | const |
Dump the state of an object.
Definition at line 851 of file Acceptor.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, and LM_DEBUG.
00852 { 00853 #if defined (ACE_HAS_DUMP) 00854 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump"); 00855 00856 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00857 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsvc_handler_ = %x"), this->svc_handler_)); 00858 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nrestart_ = %d"), this->restart_)); 00859 this->peer_acceptor_.dump (); 00860 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_concurrency_strategy_ = %d"), 00861 delete_concurrency_strategy_)); 00862 this->concurrency_strategy_->dump (); 00863 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00864 #endif /* ACE_HAS_DUMP */ 00865 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::fini | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Shared_Object.
Definition at line 1161 of file Acceptor.cpp.
References ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close().
01162 { 01163 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::fini"); 01164 return this->handle_close (); 01165 }
ACE_HANDLE ACE_Oneshot_Acceptor< SVC_HANDLER, >::get_handle | ( | void | ) | const [protected, virtual] |
Returns the listening acceptor's {ACE_HANDLE}.
Reimplemented from ACE_Event_Handler.
Definition at line 1211 of file Acceptor.cpp.
References ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::peer_acceptor_.
01212 { 01213 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle"); 01214 return this->peer_acceptor_.get_handle (); 01215 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close | ( | ACE_HANDLE | = ACE_INVALID_HANDLE , |
|
ACE_Reactor_Mask | = ACE_Event_Handler::ALL_EVENTS_MASK | |||
) | [protected, virtual] |
Perform termination activities when {this} is removed from the {reactor}.
Reimplemented from ACE_Event_Handler.
Definition at line 928 of file Acceptor.cpp.
References ACE_Event_Handler::ACCEPT_MASK, ACE_ERROR, ACE_TEXT, ACE_TRACE, ACE_Oneshot_Acceptor< SVC_HANDLER, >::concurrency_strategy_, ACE_Oneshot_Acceptor< SVC_HANDLER, >::delete_concurrency_strategy_, ACE_Event_Handler::DONT_CALL, and LM_ERROR.
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::close(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::fini(), and ACE_Oneshot_Acceptor< SVC_HANDLER, >::~ACE_Oneshot_Acceptor().
00930 { 00931 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close"); 00932 00933 // Guard against multiple closes. 00934 if (this->delete_concurrency_strategy_) 00935 { 00936 delete this->concurrency_strategy_; 00937 this->delete_concurrency_strategy_ = false; 00938 this->concurrency_strategy_ = 0; 00939 } 00940 // Note that if we aren't actually registered with the 00941 // ACE_Reactor then it's ok for this call to fail... 00942 00943 if (this->reactor ()) 00944 this->reactor ()->remove_handler 00945 (this, 00946 ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); 00947 00948 if (this->peer_acceptor_.close () == -1) 00949 ACE_ERROR ((LM_ERROR, 00950 ACE_TEXT ("close\n"))); 00951 return 0; 00952 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_input | ( | ACE_HANDLE | ) | [protected, virtual] |
Accept one connection from a client and activates the SVC_HANDLER.
Reimplemented from ACE_Event_Handler.
Definition at line 1116 of file Acceptor.cpp.
References ACE_Event_Handler::ACCEPT_MASK, ACE_TRACE, ACE_Oneshot_Acceptor< SVC_HANDLER, >::cancel(), ACE_Event_Handler::DONT_CALL, ACE_Event_Handler::reactor(), and ACE_Reactor::uses_event_associations().
01117 { 01118 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input"); 01119 int result = 0; 01120 01121 // Cancel any timer that might be pending. 01122 this->cancel (); 01123 01124 // Try to find out if the implementation of the reactor that we are 01125 // using requires us to reset the event association for the newly 01126 // created handle. This is because the newly created handle will 01127 // inherit the properties of the listen handle, including its event 01128 // associations. 01129 int reset_new_handle = this->reactor ()->uses_event_associations (); 01130 01131 // There is a use-case whereby this object will be gone upon return 01132 // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor 01133 // during the shared_accept/activation steps. So, do whatever we need 01134 // to do with this object before calling shared_accept. 01135 if (this->reactor ()) 01136 this->reactor ()->remove_handler 01137 (this, 01138 ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); 01139 01140 if (this->shared_accept (this->svc_handler_, // stream 01141 0, // remote address 01142 0, // timeout 01143 this->restart_, // restart 01144 reset_new_handle // reset new handle 01145 ) == -1) 01146 result = -1; 01147 01148 return result; 01149 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_timeout | ( | const ACE_Time_Value & | tv, | |
const void * | arg | |||
) | [protected, virtual] |
Called when an acceptor times out...
Reimplemented from ACE_Event_Handler.
Definition at line 956 of file Acceptor.cpp.
References ACE_Event_Handler::ACCEPT_MASK, ACE_TRACE, and ACE_Event_Handler::TIMER_MASK.
00958 { 00959 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_timeout"); 00960 errno = ETIME; 00961 00962 if (this->svc_handler_->handle_timeout (tv, arg) == -1) 00963 this->svc_handler_->handle_close (this->svc_handler_->get_handle (), 00964 ACE_Event_Handler::TIMER_MASK); 00965 00966 // Since we aren't necessarily registered with the Reactor, don't 00967 // bother to check the return value here... 00968 if (this->reactor ()) 00969 this->reactor ()->remove_handler (this, 00970 ACE_Event_Handler::ACCEPT_MASK); 00971 return 0; 00972 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::info | ( | ACE_TCHAR ** | , | |
size_t | ||||
) | const [protected, virtual] |
Default version returns address info in {buf}.
Reimplemented from ACE_Shared_Object.
Definition at line 1168 of file Acceptor.cpp.
References ACE_PEER_ACCEPTOR_ADDR, ACE_TEXT, ACE_TRACE, ACE_OS::sprintf(), ACE_OS::strdup(), ACE_OS::strlen(), and ACE_OS::strsncpy().
01170 { 01171 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::info"); 01172 ACE_TCHAR buf[BUFSIZ]; 01173 ACE_TCHAR addr_str[BUFSIZ]; 01174 ACE_PEER_ACCEPTOR_ADDR addr; 01175 01176 if (this->peer_acceptor_.get_local_addr (addr) == -1) 01177 return -1; 01178 else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1) 01179 return -1; 01180 01181 ACE_OS::sprintf (buf, 01182 ACE_TEXT ("%s\t %s %s"), 01183 ACE_TEXT ("ACE_Oneshot_Acceptor"), 01184 addr_str, 01185 ACE_TEXT ("#oneshot acceptor factory\n")); 01186 01187 if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) 01188 return -1; 01189 else 01190 ACE_OS::strsncpy (*strp, buf, length); 01191 return static_cast<int> (ACE_OS::strlen (buf)); 01192 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::init | ( | int | argc, | |
ACE_TCHAR * | argv[] | |||
) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Shared_Object.
Definition at line 1154 of file Acceptor.cpp.
References ACE_TRACE.
01155 { 01156 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::init"); 01157 return -1; 01158 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::open | ( | const ACE_PEER_ACCEPTOR_ADDR & | , | |
ACE_Reactor * | reactor = ACE_Reactor::instance() , |
|||
ACE_Concurrency_Strategy< SVC_HANDLER > * | = 0 | |||
) |
Initialize the appropriate strategies for concurrency and then open the {peer_acceptor} at the designated {local_addr}. Note that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this method does NOT register {this} acceptor with the {reactor} at this point -- it just stashes the {reactor} away in case it's needed later.
Definition at line 869 of file Acceptor.cpp.
References ACE_NEW_RETURN, and ACE_TRACE.
00872 { 00873 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open"); 00874 this->reactor (reactor); 00875 00876 // Initialize the concurrency strategy. 00877 00878 if (con_s == 0) 00879 { 00880 ACE_NEW_RETURN (con_s, 00881 ACE_Concurrency_Strategy<SVC_HANDLER>, 00882 -1); 00883 this->delete_concurrency_strategy_ = true; 00884 } 00885 this->concurrency_strategy_ = con_s; 00886 00887 // Reuse the addr, even if it is already in use...! 00888 return this->peer_acceptor_.open (local_addr, 1); 00889 }
ACE_Oneshot_Acceptor< SVC_HANDLER, >::operator ACE_PEER_ACCEPTOR & | ( | ) | const [virtual] |
Return the underlying {PEER_ACCEPTOR} object.
Definition at line 1225 of file Acceptor.cpp.
References ACE_PEER_ACCEPTOR, ACE_TRACE, and ACE_Oneshot_Acceptor< SVC_HANDLER, >::peer_acceptor_.
01226 { 01227 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::operator ACE_PEER_ACCEPTOR &"); 01228 return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; 01229 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::register_handler | ( | SVC_HANDLER * | svc_handler, | |
const ACE_Synch_Options & | options, | |||
int | restart | |||
) | [private] |
Insert ourselves into the {ACE_Reactor} so that we can continue accepting this connection asynchronously. This method should NOT be called by developers directly.
Definition at line 983 of file Acceptor.cpp.
References ACE_Event_Handler::ACCEPT_MASK, ACE_TRACE, ACE_Synch_Options::arg(), ACE_Reactor::register_handler(), and ACE_Synch_Options::time_value().
00986 { 00987 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::register_handler"); 00988 // Can't do this if we don't have a Reactor. 00989 if (this->reactor () == 0) 00990 { 00991 errno = EINVAL; 00992 return -1; 00993 } 00994 else 00995 { 00996 this->svc_handler_ = svc_handler; 00997 this->restart_ = restart; 00998 ACE_Time_Value *tv = (ACE_Time_Value *) synch_options.time_value (); 00999 01000 if (tv != 0 01001 && this->reactor ()->schedule_timer (this, 01002 synch_options.arg (), 01003 *tv) == 0) 01004 return -1; 01005 else 01006 return this->reactor ()->register_handler 01007 (this, 01008 ACE_Event_Handler::ACCEPT_MASK); 01009 } 01010 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::resume | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Service_Object.
Definition at line 1202 of file Acceptor.cpp.
References ACE_TRACE, ACE_Event_Handler::reactor(), and ACE_Reactor::resume_handler().
01203 { 01204 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::resume"); 01205 return this->reactor () && this->reactor ()->resume_handler (this); 01206 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::shared_accept | ( | SVC_HANDLER * | svc_handler, | |
ACE_PEER_ACCEPTOR_ADDR * | remote_addr, | |||
ACE_Time_Value * | timeout, | |||
int | restart, | |||
int | reset_new_handle | |||
) | [protected] |
Factors out the code shared between the {accept} and {handle_input} methods.
Definition at line 1035 of file Acceptor.cpp.
References ACE_TRACE.
01040 { 01041 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::shared_accept"); 01042 if (svc_handler == 0) 01043 return -1; 01044 01045 // Accept connection into the Svc_Handler. 01046 else if (this->peer_acceptor_.accept (svc_handler->peer (), // stream 01047 remote_addr, // remote address 01048 timeout, // timeout 01049 restart, // restart 01050 reset_new_handle // reset new handle 01051 ) == -1) 01052 { 01053 // Check whether we just timed out or whether we failed... 01054 if (!(errno == EWOULDBLOCK || errno == ETIME)) 01055 // Close down handler to avoid memory leaks. 01056 svc_handler->close (0); 01057 return -1; 01058 } 01059 // Activate the <svc_handler> using the designated concurrency 01060 // strategy (note that this method becomes responsible for handling 01061 // errors and freeing up the memory if things go awry...) 01062 else 01063 return this->activate_svc_handler (svc_handler); 01064 }
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::suspend | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Service_Object.
Definition at line 1195 of file Acceptor.cpp.
References ACE_TRACE, ACE_Event_Handler::reactor(), and ACE_Reactor::suspend_handler().
01196 { 01197 ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::suspend"); 01198 return this->reactor () && this->reactor ()->suspend_handler (this); 01199 }
ACE_Oneshot_Acceptor< SVC_HANDLER, >::ACE_ALLOC_HOOK_DECLARE |
ACE_Concurrency_Strategy<SVC_HANDLER>* ACE_Oneshot_Acceptor< SVC_HANDLER, >::concurrency_strategy_ [private] |
Concurrency strategy for an Acceptor.
Definition at line 669 of file Acceptor.h.
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close().
bool ACE_Oneshot_Acceptor< SVC_HANDLER, >::delete_concurrency_strategy_ [private] |
true if Acceptor created the concurrency strategy and thus should delete it, else false.
Definition at line 673 of file Acceptor.h.
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close().
ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, >::peer_acceptor_ [private] |
Factory that establishes connections passively.
Definition at line 666 of file Acceptor.h.
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::acceptor(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::get_handle(), and ACE_Oneshot_Acceptor< SVC_HANDLER, >::operator ACE_PEER_ACCEPTOR &().
int ACE_Oneshot_Acceptor< SVC_HANDLER, >::restart_ [private] |
SVC_HANDLER* ACE_Oneshot_Acceptor< SVC_HANDLER, >::svc_handler_ [private] |