Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes

ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 > Class Template Reference

Generic factory for passively connecting clients and creating exactly one service handler of the type SVC_HANDLER specified in the template. More...

#include <Acceptor.h>

Inheritance diagram for ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >:
Collaboration graph
[legend]

List of all members.

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_

Detailed Description

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:

  1. 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().
  2. 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:

Definition at line 532 of file Acceptor.h.


Member Typedef Documentation

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
typedef ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor_type

Definition at line 538 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
typedef ACE_PEER_ACCEPTOR_ADDR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::addr_type

Definition at line 537 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
typedef SVC_HANDLER ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handler_type

Definition at line 539 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
typedef SVC_HANDLER::stream_type ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::stream_type

Definition at line 540 of file Acceptor.h.


Constructor & Destructor Documentation

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Oneshot_Acceptor ( void   ) 

Constructor.

Definition at line 905 of file Acceptor.cpp.

  : delete_concurrency_strategy_ (false)
{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor");
  this->reactor (0);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Oneshot_Acceptor ( const ACE_PEER_ACCEPTOR_ADDR &  local_addr,
ACE_Reactor reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy< SVC_HANDLER > *  cs = 0 
)

Initialize the appropriate strategies for concurrency and then open the acceptor at the designated local_addr. Note that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this method does NOT register this acceptor with the reactor at this point -- the reactor parameter is saved in case it's needed later.

Definition at line 914 of file Acceptor.cpp.

    : delete_concurrency_strategy_ (false)
{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor");
  if (this->open (local_addr, reactor, cs) == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("%p\n"),
                ACE_TEXT ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor")));
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::~ACE_Oneshot_Acceptor ( void   )  [virtual]

Close down the {Oneshot_Acceptor}.

Definition at line 927 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Oneshot_Acceptor");
  this->handle_close ();
}


Member Function Documentation

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::accept ( SVC_HANDLER *  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]

Create a {SVC_HANDLER}, accept the connection into the {SVC_HANDLER}, and activate the {SVC_HANDLER}.

Definition at line 1085 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept");
  // Note that if timeout == ACE_Time_Value (x, y) where (x > 0 || y >
  // 0) then this->connector_.connect() will block synchronously.  If
  // <use_reactor> is set then we don't want this to happen (since we
  // want the ACE_Reactor to do the timeout asynchronously).
  // Therefore, we'll force this->connector_ to use ACE_Time_Value (0,
  // 0) in this case...

  ACE_Time_Value *timeout;
  int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR];

  if (use_reactor)
    timeout = (ACE_Time_Value *) &ACE_Time_Value::zero;
  else
    timeout = (ACE_Time_Value *) synch_options.time_value ();

  if (this->shared_accept (svc_handler, // stream
                           remote_addr, // remote address
                           timeout, // timeout
                           restart, // restart
                           reset_new_handle // reset new handler
                           ) == -1)
    {
      if (use_reactor && errno == EWOULDBLOCK)
        // We couldn't accept right away, so let's wait in the
        // <ACE_Reactor>.
        this->register_handler (svc_handler,
                                synch_options,
                                restart);
      return -1;
    }
  return 0;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_PEER_ACCEPTOR & ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor ( void   )  const [virtual]

Return the underlying {PEER_ACCEPTOR} object.

Definition at line 1231 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor");
  return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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 1035 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler");
  return this->concurrency_strategy_->activate_svc_handler
    (svc_handler,
     (void *) this);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::cancel ( void   )  [virtual]

Cancel a oneshot acceptor that was started asynchronously.

Definition at line 988 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::cancel");
  return this->reactor () && this->reactor ()->cancel_timer (this);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::close ( void   )  [virtual]

Close down the {Oneshot_Acceptor}.

Definition at line 934 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::close");
  return this->handle_close ();
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
void ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::dump ( void   )  const

Dump the state of an object.

Definition at line 864 of file Acceptor.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
  ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("\nsvc_handler_ = %x"), this->svc_handler_));
  ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("\nrestart_ = %d"), this->restart_));
  this->peer_acceptor_.dump ();
  ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("delete_concurrency_strategy_ = %d"),
              delete_concurrency_strategy_));
  this->concurrency_strategy_->dump ();
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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 1174 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::fini");
  return this->handle_close ();
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_HANDLE ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::get_handle ( void   )  const [protected, virtual]

Returns the listening acceptor's {ACE_HANDLE}.

Definition at line 1224 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle");
  return this->peer_acceptor_.get_handle ();
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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}.

Definition at line 941 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close");

  // Guard against multiple closes.
  if (this->delete_concurrency_strategy_)
    {
      delete this->concurrency_strategy_;
      this->delete_concurrency_strategy_ = false;
      this->concurrency_strategy_ = 0;
    }
  // Note that if we aren't actually registered with the
  // ACE_Reactor then it's ok for this call to fail...

  if (this->reactor ())
    this->reactor ()->remove_handler
      (this,
       ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);

  if (this->peer_acceptor_.close () == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("close\n")));
  return 0;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handle_input ( ACE_HANDLE   )  [protected, virtual]

Accept one connection from a client and activates the SVC_HANDLER.

Definition at line 1129 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input");
  int result = 0;

  // Cancel any timer that might be pending.
  this->cancel ();

  // Try to find out if the implementation of the reactor that we are
  // using requires us to reset the event association for the newly
  // created handle.  This is because the newly created handle will
  // inherit the properties of the listen handle, including its event
  // associations.
  bool const reset_new_handle = this->reactor ()->uses_event_associations ();

  // There is a use-case whereby this object will be gone upon return
  // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor
  // during the shared_accept/activation steps. So, do whatever we need
  // to do with this object before calling shared_accept.
  if (this->reactor ())
    this->reactor ()->remove_handler
      (this,
       ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);

  if (this->shared_accept (this->svc_handler_, // stream
                           0, // remote address
                           0, // timeout
                           this->restart_, // restart
                           reset_new_handle // reset new handle
                           ) == -1)
    result = -1;

  return result;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handle_timeout ( const ACE_Time_Value tv,
const void *  arg 
) [protected, virtual]

Called when an acceptor times out...

Definition at line 969 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_timeout");
  errno = ETIME;

  if (this->svc_handler_->handle_timeout (tv, arg) == -1)
    this->svc_handler_->handle_close (this->svc_handler_->get_handle (),
                                      ACE_Event_Handler::TIMER_MASK);

  // Since we aren't necessarily registered with the Reactor, don't
  // bother to check the return value here...
  if (this->reactor ())
    this->reactor ()->remove_handler (this,
                                      ACE_Event_Handler::ACCEPT_MASK);
  return 0;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::info ( ACE_TCHAR **  strp,
size_t  length 
) const [protected, virtual]

Default version returns address info in {buf}.

Reimplemented from ACE_Shared_Object.

Definition at line 1181 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::info");
  ACE_TCHAR buf[BUFSIZ];
  ACE_TCHAR addr_str[BUFSIZ];
  ACE_PEER_ACCEPTOR_ADDR addr;

  if (this->peer_acceptor_.get_local_addr (addr) == -1)
    return -1;
  else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1)
    return -1;

  ACE_OS::sprintf (buf,
                   ACE_TEXT ("%s\t %s %s"),
                   ACE_TEXT ("ACE_Oneshot_Acceptor"),
                   addr_str,
                   ACE_TEXT ("#oneshot acceptor factory\n"));

  if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
    return -1;
  else
    ACE_OS::strsncpy (*strp, buf, length);
  return static_cast<int> (ACE_OS::strlen (buf));
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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 1167 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::init");
  return -1;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::open ( const ACE_PEER_ACCEPTOR_ADDR &  local_addr,
ACE_Reactor reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy< SVC_HANDLER > *  con_s = 0 
)

Initialize the appropriate strategies for concurrency and then open the acceptor at the designated local_addr. Note that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this method does NOT register this acceptor with the reactor at this point -- the reactor parameter is saved in case it's needed later.

Definition at line 882 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open");
  this->reactor (reactor);

  // Initialize the concurrency strategy.

  if (con_s == 0)
    {
      ACE_NEW_RETURN (con_s,
                      ACE_Concurrency_Strategy<SVC_HANDLER>,
                      -1);
      this->delete_concurrency_strategy_ = true;
    }
  this->concurrency_strategy_ = con_s;

  // Reuse the addr, even if it is already in use...!
  return this->peer_acceptor_.open (local_addr, 1);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::operator ACE_PEER_ACCEPTOR & (  )  const [virtual]

Return the underlying {PEER_ACCEPTOR} object.

Definition at line 1238 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::operator ACE_PEER_ACCEPTOR &");
  return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_;
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::register_handler ( SVC_HANDLER *  svc_handler,
const ACE_Synch_Options options,
bool  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 996 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::register_handler");
  // Can't do this if we don't have a Reactor.
  if (this->reactor () == 0)
    {
      errno = EINVAL;
      return -1;
    }
  else
    {
      this->svc_handler_ = svc_handler;
      this->restart_ = restart;
      ACE_Time_Value *tv = (ACE_Time_Value *) synch_options.time_value ();

      if (tv != 0
          && this->reactor ()->schedule_timer (this,
                                               synch_options.arg (),
                                               *tv) == 0)
        return -1;
      else
        return this->reactor ()->register_handler
          (this,
           ACE_Event_Handler::ACCEPT_MASK);
    }
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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 1215 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::resume");
  return this->reactor () && this->reactor ()->resume_handler (this);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::shared_accept ( SVC_HANDLER *  svc_handler,
ACE_PEER_ACCEPTOR_ADDR *  remote_addr,
ACE_Time_Value timeout,
bool  restart,
bool  reset_new_handle 
) [protected]

Factors out the code shared between the {accept} and {handle_input} methods.

Definition at line 1048 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::shared_accept");
  if (svc_handler == 0)
    return -1;

  // Accept connection into the Svc_Handler.
  else if (this->peer_acceptor_.accept (svc_handler->peer (), // stream
                                        remote_addr, // remote address
                                        timeout, // timeout
                                        restart, // restart
                                        reset_new_handle // reset new handle
                                        ) == -1)
    {
      // Check whether we just timed out or whether we failed...
      if (!(errno == EWOULDBLOCK || errno == ETIME))
        // Close down handler to avoid memory leaks.
        svc_handler->close (CLOSE_DURING_NEW_CONNECTION);
      return -1;
    }
  // Activate the <svc_handler> using the designated concurrency
  // strategy (note that this method becomes responsible for handling
  // errors and freeing up the memory if things go awry...)
  else
    return this->activate_svc_handler (svc_handler);
}

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::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 1208 of file Acceptor.cpp.

{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::suspend");
  return this->reactor () && this->reactor ()->suspend_handler (this);
}


Member Data Documentation

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Definition at line 597 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_Concurrency_Strategy<SVC_HANDLER>* ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::concurrency_strategy_ [private]

Concurrency strategy for an Acceptor.

Definition at line 676 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
bool ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::delete_concurrency_strategy_ [private]

true if Acceptor created the concurrency strategy and thus should delete it, else false.

Definition at line 680 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::peer_acceptor_ [private]

Factory that establishes connections passively.

Definition at line 673 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
bool ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::restart_ [private]

Hold the restart flag across asynchrony boundaries.

Definition at line 670 of file Acceptor.h.

template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
SVC_HANDLER* ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::svc_handler_ [private]

Hold the svc_handler_ across asynchrony boundaries.

Definition at line 667 of file Acceptor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines