3 //=============================================================================
7 * $Id: Acceptor.h 81460 2008-04-28 11:34:23Z elliott_c $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_ACCEPTOR_H
14 #define ACE_ACCEPTOR_H
16 #include /**/ "ace/pre.h"
18 #include "ace/Service_Object.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Strategies_T.h"
25 #include "ace/Synch_Options.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 * @brief Abstract factory for creating a service handler
33 * (SVC_HANDLER), accepting into the SVC_HANDLER, and
34 * activating the SVC_HANDLER.
36 * Implements the basic strategy for passively establishing
37 * connections with clients. An ACE_Acceptor is parameterized
38 * by concrete types that conform to the interfaces of
39 * PEER_ACCEPTOR and SVC_HANDLER. The PEER_ACCEPTOR is
40 * instantiated with a transport mechanism that passively
41 * establishes connections. The SVC_HANDLER is instantiated
42 * with a concrete type that performs the application-specific
43 * service. An ACE_Acceptor inherits from ACE_Service_Object,
44 * which in turn inherits from ACE_Event_Handler. This enables
45 * the ACE_Reactor to dispatch the ACE_Acceptor's handle_input
46 * method when connection events occur. The handle_input method
47 * performs the ACE_Acceptor's default creation, connection
48 * establishment, and service activation strategies. These
49 * strategies can be overridden by subclasses individually or as
52 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
>
53 class ACE_Acceptor
: public ACE_Service_Object
57 // Useful STL-style traits.
58 typedef ACE_PEER_ACCEPTOR_ADDR addr_type
;
59 typedef ACE_PEER_ACCEPTOR acceptor_type
;
60 typedef SVC_HANDLER handler_type
;
61 typedef typename
SVC_HANDLER::stream_type stream_type
;
63 /// "Do-nothing" constructor.
64 ACE_Acceptor (ACE_Reactor
* = 0,
68 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
69 * register with the specified reactor for accept events. An
70 * acceptor can only listen to one port at a time, so make sure to
71 * @c close() the acceptor before calling @c open() again.
73 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
74 * safeguard against the race condition that can otherwise occur
75 * between the time when the passive-mode socket handle is "ready"
76 * and when the actual @c accept() call is made. During this
77 * interval, the client can shutdown the connection, in which case,
78 * the @c accept() call can hang.
80 * @param local_addr The address to listen at.
81 * @param reactor Pointer to the ACE_Reactor instance to register
82 * this object with. The default is the singleton.
83 * @param flags Flags to control what mode an accepted socket
84 * will be put into after it is accepted. The only
85 * legal value for this argument is @c ACE_NONBLOCK,
86 * which enables non-blocking mode on the accepted
87 * peer stream object in @c SVC_HANDLER. The default
89 * @param use_select Affects behavior when called back by the reactor
90 * when a connection can be accepted. If non-zero,
91 * this object will accept all pending connections,
92 * intead of just the one that triggered the reactor
93 * callback. Uses ACE_OS::select() internally to
94 * detect any remaining acceptable connections.
96 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
97 * @p local_addr. Generally used to request that the
98 * OS allow reuse of the listen port. The default is 1.
100 ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
101 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
107 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
108 * register with the specified reactor for accept events. An
109 * acceptor can only listen to one port at a time, so make sure to
110 * @c close() the acceptor before calling @c open() again.
112 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
113 * safeguard against the race condition that can otherwise occur
114 * between the time when the passive-mode socket handle is "ready"
115 * and when the actual @c accept() call is made. During this
116 * interval, the client can shutdown the connection, in which case,
117 * the @c accept() call can hang.
119 * @param local_addr The address to listen at.
120 * @param reactor Pointer to the ACE_Reactor instance to register
121 * this object with. The default is the singleton.
122 * @param flags Flags to control what mode an accepted socket
123 * will be put into after it is accepted. The only
124 * legal value for this argument is @c ACE_NONBLOCK,
125 * which enables non-blocking mode on the accepted
126 * peer stream object in @c SVC_HANDLER. The default
128 * @param use_select Affects behavior when called back by the reactor
129 * when a connection can be accepted. If non-zero,
130 * this object will accept all pending connections,
131 * intead of just the one that triggered the reactor
132 * callback. Uses ACE_OS::select() internally to
133 * detect any remaining acceptable connections.
135 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
136 * @p local_addr. Generally used to request that the
137 * OS allow reuse of the listen port. The default is 1.
140 * @retval -1 Failure, @c errno contains an error code.
142 virtual int open (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
143 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
148 /// Close down the Acceptor's resources.
149 virtual ~ACE_Acceptor (void);
151 /// Return the underlying PEER_ACCEPTOR object.
152 virtual operator ACE_PEER_ACCEPTOR
&() const;
154 /// Return the underlying PEER_ACCEPTOR object.
155 virtual ACE_PEER_ACCEPTOR
&acceptor (void) const;
157 /// Returns the listening acceptor's {ACE_HANDLE}.
158 virtual ACE_HANDLE
get_handle (void) const;
160 /// Close down the Acceptor
161 virtual int close (void);
163 /// In the event that an accept fails, this method will be called and
164 /// the return value will be returned from handle_input().
165 virtual int handle_accept_error (void);
167 /// Dump the state of an object.
168 void dump (void) const;
170 /// Declare the dynamic allocation hooks.
171 ACE_ALLOC_HOOK_DECLARE
;
174 // = The following three methods define the Acceptor's strategies
175 // for creating, accepting, and activating SVC_HANDLER's,
179 * Bridge method for creating a SVC_HANDLER. The default is to
180 * create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged.
181 * However, subclasses can override this policy to perform
182 * SVC_HANDLER creation in any way that they like (such as creating
183 * subclass instances of SVC_HANDLER, using a singleton, dynamically
184 * linking the handler, etc.). Returns -1 on failure, else 0.
186 virtual int make_svc_handler (SVC_HANDLER
*&sh
);
189 * Bridge method for accepting the new connection into the
190 * <svc_handler>. The default behavior delegates to the
191 * PEER_ACCEPTOR::accept.
193 virtual int accept_svc_handler (SVC_HANDLER
*svc_handler
);
196 * Bridge method for activating a {svc_handler} with the appropriate
197 * concurrency strategy. The default behavior of this method is to
198 * activate the SVC_HANDLER by calling its {open} method (which
199 * allows the SVC_HANDLER to define its own concurrency strategy).
200 * However, subclasses can override this strategy to do more
201 * sophisticated concurrency activations (such as making the
202 * SVC_HANDLER as an "active object" via multi-threading or
205 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
207 // = Demultiplexing hooks.
208 /// Perform termination activities when {this} is removed from the
210 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
211 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
213 /// Accepts all pending connections from clients, and creates and
214 /// activates SVC_HANDLERs.
215 virtual int handle_input (ACE_HANDLE
);
217 // = Dynamic linking hooks.
218 /// Default version does no work and returns -1. Must be overloaded
219 /// by application developer to do anything meaningful.
220 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
222 /// Calls {handle_close}.
223 virtual int fini (void);
225 /// Default version returns address info in {buf}.
226 virtual int info (ACE_TCHAR
**buf
, size_t) const;
229 // = Service management hooks.
230 /// This method calls {Reactor::suspend}.
231 virtual int suspend (void);
233 /// This method calls {Reactor::resume}.
234 virtual int resume (void);
237 /// Concrete factory for accepting connections from clients...
238 ACE_PEER_ACCEPTOR peer_acceptor_
;
240 /// Needed to reopen the socket if {accept} fails.
241 ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_
;
244 * Flags that indicate how {SVC_HANDLER}'s should be initialized
245 * prior to being activated. Right now, the only flag that is
246 * processed is {ACE_NONBLOCK}, which enabled non-blocking I/O on
247 * the {SVC_HANDLER} when it is opened.
251 /// Flag that indicates whether it shall use {select} in the
255 /// Needed to reopen the socket if {accept} fails.
260 * @class ACE_Strategy_Acceptor
262 * @brief Abstract factory for creating a service handler
263 * (SVC_HANDLER), accepting into the SVC_HANDLER, and activating
266 * Implements a flexible and extensible set of strategies for
267 * passively establishing connections with clients. There are
268 * three main strategies: (1) creating a SVC_HANDLER, (2)
269 * passively accepting a new connection from a client into the
270 * SVC_HANDLER, and (3) activating the SVC_HANDLER with a
271 * particular concurrency mechanism.
273 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
>
274 class ACE_Strategy_Acceptor
275 : public ACE_Acceptor
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>
279 // Useful STL-style traits.
280 typedef ACE_Creation_Strategy
<SVC_HANDLER
>
281 creation_strategy_type
;
282 typedef ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>
283 accept_strategy_type
;
284 typedef ACE_Concurrency_Strategy
<SVC_HANDLER
>
285 concurrency_strategy_type
;
286 typedef ACE_Scheduling_Strategy
<SVC_HANDLER
> scheduling_strategy_type
;
287 typedef ACE_Acceptor
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>
290 // = Define some useful (old style) traits.
291 typedef ACE_Creation_Strategy
<SVC_HANDLER
> CREATION_STRATEGY
;
292 typedef ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
> ACCEPT_STRATEGY
;
293 typedef ACE_Concurrency_Strategy
<SVC_HANDLER
> CONCURRENCY_STRATEGY
;
294 typedef ACE_Scheduling_Strategy
<SVC_HANDLER
> SCHEDULING_STRATEGY
;
298 /// Default constructor.
299 ACE_Strategy_Acceptor (const ACE_TCHAR service_name
[] = 0,
300 const ACE_TCHAR service_description
[] = 0,
305 * Initialize the appropriate strategies for creation, passive
306 * connection acceptance, and concurrency, and then register {this}
307 * with the Reactor and listen for connection requests at the
308 * designated {local_addr}.
310 ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
311 ACE_Reactor
* = ACE_Reactor::instance (),
312 ACE_Creation_Strategy
<SVC_HANDLER
> * = 0,
313 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
> * = 0,
314 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0,
315 ACE_Scheduling_Strategy
<SVC_HANDLER
> * = 0,
316 const ACE_TCHAR service_name
[] = 0,
317 const ACE_TCHAR service_description
[] = 0,
322 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
323 * register with the specified reactor for accept events.
325 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
326 * safeguard against the race condition that can otherwise occur
327 * between the time when the passive-mode socket handle is "ready"
328 * and when the actual @c accept call is made. During this
329 * interval, the client can shutdown the connection, in which case,
330 * the {accept} call can hang.
332 * @param local_addr The address to listen at.
333 * @param reactor Pointer to the ACE_Reactor instance to register
334 * this object with. The default is the singleton.
335 * @param flags Flags to control what mode an accepted socket
336 * will be put into after it is accepted. The only
337 * legal value for this argument is @c ACE_NONBLOCK,
338 * which enables non-blocking mode on the accepted
339 * peer stream object in @c SVC_HANDLER. The default
341 * @param use_select Affects behavior when called back by the reactor
342 * when a connection can be accepted. If non-zero,
343 * this object will accept all pending connections,
344 * intead of just the one that triggered the reactor
345 * callback. Uses ACE_OS::select() internally to
346 * detect any remaining acceptable connections.
348 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
349 * @p local_addr. Generally used to request that the
350 * OS allow reuse of the listen port. The default is 1.
353 * @retval -1 Failure, @c errno contains an error code.
355 virtual int open (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
356 ACE_Reactor
*reactor
,
362 * Initialize the appropriate strategies for creation, passive
363 * connection acceptance, and concurrency, and then register {this}
364 * with the Reactor and listen for connection requests at the
365 * designated {local_addr}.
367 virtual int open (const ACE_PEER_ACCEPTOR_ADDR
&,
368 ACE_Reactor
* = ACE_Reactor::instance (),
369 ACE_Creation_Strategy
<SVC_HANDLER
> * = 0,
370 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
> * =0,
371 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0,
372 ACE_Scheduling_Strategy
<SVC_HANDLER
> * = 0,
373 const ACE_TCHAR
*service_name
= 0,
374 const ACE_TCHAR
*service_description
= 0,
378 /// Close down the Strategy_Acceptor's resources.
379 virtual ~ACE_Strategy_Acceptor (void);
381 /// Return the underlying PEER_ACCEPTOR object.
382 virtual operator ACE_PEER_ACCEPTOR
&() const;
384 /// Return the underlying PEER_ACCEPTOR object.
385 virtual ACE_PEER_ACCEPTOR
&acceptor (void) const;
387 /// Returns the listening acceptor's {ACE_HANDLE}.
388 virtual ACE_HANDLE
get_handle (void) const;
390 /// Dump the state of an object.
391 void dump (void) const;
393 /// Declare the dynamic allocation hooks.
394 ACE_ALLOC_HOOK_DECLARE
;
396 // = Service management hooks.
398 /// This method delegates to the {Scheduling_Strategy}'s {suspend}
400 virtual int suspend (void);
402 /// This method delegates to the {Scheduling_Strategy}'s {resume}
404 virtual int resume (void);
408 /// Calls {handle_close} when dynamically unlinked.
409 virtual int fini (void);
411 /// Default version returns address info in {buf}.
412 virtual int info (ACE_TCHAR
**buf
, size_t) const;
414 // = The following three methods define the {Acceptor}'s strategies
415 // for creating, accepting, and activating {SVC_HANDLER}'s,
419 * Bridge method for creating a {SVC_HANDLER}. The strategy for
420 * creating a {SVC_HANDLER} are configured into the Acceptor via
421 * it's {creation_strategy_}. The default is to create a new
422 * {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However,
423 * subclasses can override this policy to perform {SVC_HANDLER}
424 * creation in any way that they like (such as creating subclass
425 * instances of {SVC_HANDLER}, using a singleton, dynamically
426 * linking the handler, etc.). Returns -1 on failure, else 0.
428 virtual int make_svc_handler (SVC_HANDLER
*&);
431 * Bridge method for accepting the new connection into the
432 * {SVC_HANDLER}. The default behavior delegates to the
433 * {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}.
435 virtual int accept_svc_handler (SVC_HANDLER
*svc_handler
);
438 * Bridge method for activating a {SVC_HANDLER} with the appropriate
439 * concurrency strategy. The default behavior of this method is to
440 * activate the {SVC_HANDLER} by calling its {open} method (which
441 * allows the {SVC_HANDLER} to define its own concurrency strategy).
442 * However, subclasses can override this strategy to do more
443 * sophisticated concurrency activations (such as creating the
444 * {SVC_HANDLER} as an "active object" via multi-threading or
447 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
449 // = Demultiplexing hooks.
450 /// Perform termination activities when {this} is removed from the
452 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
453 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
456 virtual int handle_signal (int signum
, siginfo_t
*, ucontext_t
*);
458 // = These data members are "logically private" but are put in the
459 // protected part in case subclasses want to access them.
461 // = Strategy objects.
463 /// Creation strategy for an Acceptor.
464 CREATION_STRATEGY
*creation_strategy_
;
466 /// true if {Acceptor} created the creation strategy and thus should
467 /// delete it, else false.
468 bool delete_creation_strategy_
;
470 /// Accept strategy for an {Acceptor}.
471 ACCEPT_STRATEGY
*accept_strategy_
;
473 /// true if {Acceptor} created the accept strategy and thus should delete
475 bool delete_accept_strategy_
;
477 /// Concurrency strategy for an {Acceptor}.
478 CONCURRENCY_STRATEGY
*concurrency_strategy_
;
480 /// true if {Acceptor} created the concurrency strategy and thus should
481 /// delete it, else false.
482 bool delete_concurrency_strategy_
;
484 /// Scheduling strategy for an {Acceptor}.
485 SCHEDULING_STRATEGY
*scheduling_strategy_
;
487 /// true if {Acceptor} created the scheduling strategy and thus should
488 /// delete it, else false.
489 bool delete_scheduling_strategy_
;
491 // = Service information objects.
493 /// Name of the service.
494 ACE_TCHAR
*service_name_
;
496 /// Description of the service.
497 ACE_TCHAR
*service_description_
;
499 /// Address that the {Strategy_Acceptor} uses to listen for
501 ACE_PEER_ACCEPTOR_ADDR service_addr_
;
505 * @class ACE_Oneshot_Acceptor
507 * @brief Generic factory for passively connecting clients and creating
508 * exactly one service handler (SVC_HANDLER).
510 * This class works similarly to the regular {ACE_Acceptor},
511 * with the following differences:
512 * 1. This class doesn't automagically register {this} with the
513 * {ACE_Reactor} since it expects to have its {accept} method
514 * called directly. However, it stashes the {ACE_Reactor}
515 * pointer away in case it's needed later to finish accepting
516 * a connection asynchronously.
517 * 2. The class doesn't need an {ACE_Creation_Strategy} (since
518 * the user supplies the SVC_HANDLER) or an
519 * {ACE_Accept_Strategy} (since this class only accepts one
520 * connection and then removes all traces of itself from the
521 * {ACE_Reactor} if it was registered for asynchronous
524 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
>
525 class ACE_Oneshot_Acceptor
: public ACE_Service_Object
529 // Useful STL-style traits.
530 typedef ACE_PEER_ACCEPTOR_ADDR addr_type
;
531 typedef ACE_PEER_ACCEPTOR acceptor_type
;
532 typedef SVC_HANDLER handler_type
;
533 typedef typename
SVC_HANDLER::stream_type stream_type
;
536 ACE_Oneshot_Acceptor (void);
539 * Initialize the appropriate strategies for concurrency and then
540 * open the {peer_acceptor} at the designated {local_addr}. Note
541 * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this
542 * method does NOT register {this} acceptor with the {reactor} at
543 * this point -- it just stashes the {reactor} away in case it's
546 ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
547 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
548 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0);
551 * Initialize the appropriate strategies for concurrency and then
552 * open the {peer_acceptor} at the designated {local_addr}. Note
553 * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this
554 * method does NOT register {this} acceptor with the {reactor} at
555 * this point -- it just stashes the {reactor} away in case it's
558 int open (const ACE_PEER_ACCEPTOR_ADDR
&,
559 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
560 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0);
562 /// Close down the {Oneshot_Acceptor}.
563 virtual ~ACE_Oneshot_Acceptor (void);
565 // = Explicit factory operation.
566 /// Create a {SVC_HANDLER}, accept the connection into the
567 /// {SVC_HANDLER}, and activate the {SVC_HANDLER}.
568 virtual int accept (SVC_HANDLER
* = 0,
569 ACE_PEER_ACCEPTOR_ADDR
*remote_addr
= 0,
570 const ACE_Synch_Options
&synch_options
= ACE_Synch_Options::defaults
,
572 int reset_new_handle
= 0);
574 /// Cancel a oneshot acceptor that was started asynchronously.
575 virtual int cancel (void);
577 /// Return the underlying {PEER_ACCEPTOR} object.
578 virtual operator ACE_PEER_ACCEPTOR
&() const;
580 /// Return the underlying {PEER_ACCEPTOR} object.
581 virtual ACE_PEER_ACCEPTOR
&acceptor (void) const;
583 /// Close down the {Oneshot_Acceptor}.
584 virtual int close (void);
586 /// Dump the state of an object.
587 void dump (void) const;
589 /// Declare the dynamic allocation hooks.
590 ACE_ALLOC_HOOK_DECLARE
;
594 * Bridge method for activating a {svc_handler} with the appropriate
595 * concurrency strategy. Default behavior is to activate the
596 * {SVC_HANDLER} as a "passive object." However, subclasses can
597 * override this strategy to do more sophisticated concurrency
598 * activations (such as creating the {SVC_HANDLER} as an "active
599 * object" via multi-threading or multi-processing).
601 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
603 /// Factors out the code shared between the {accept} and
604 /// {handle_input} methods.
605 int shared_accept (SVC_HANDLER
*svc_handler
,
606 ACE_PEER_ACCEPTOR_ADDR
*remote_addr
,
607 ACE_Time_Value
*timeout
,
609 int reset_new_handle
);
611 // = Demultiplexing hooks.
612 /// Returns the listening acceptor's {ACE_HANDLE}.
613 virtual ACE_HANDLE
get_handle (void) const;
615 /// Perform termination activities when {this} is removed from the
617 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
618 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
620 /// Accept one connection from a client and activates the
622 virtual int handle_input (ACE_HANDLE
);
624 /// Called when an acceptor times out...
625 virtual int handle_timeout (const ACE_Time_Value
&tv
,
628 // = Dynamic linking hooks.
629 /// Default version does no work and returns -1. Must be overloaded
630 /// by application developer to do anything meaningful.
631 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
633 /// Default version does no work and returns -1. Must be overloaded
634 /// by application developer to do anything meaningful.
635 virtual int fini (void);
637 /// Default version returns address info in {buf}.
638 virtual int info (ACE_TCHAR
**, size_t) const;
640 // = Service management hooks.
641 /// Default version does no work and returns -1. Must be overloaded
642 /// by application developer to do anything meaningful.
643 virtual int suspend (void);
645 /// Default version does no work and returns -1. Must be overloaded
646 /// by application developer to do anything meaningful.
647 virtual int resume (void);
651 * Insert ourselves into the {ACE_Reactor} so that we can continue
652 * accepting this connection asynchronously. This method should NOT
653 * be called by developers directly.
655 int register_handler (SVC_HANDLER
*svc_handler
,
656 const ACE_Synch_Options
&options
,
659 /// Hold the svc_handler_ across asynchrony boundaries.
660 SVC_HANDLER
*svc_handler_
;
662 /// Hold the restart flag across asynchrony boundaries.
665 /// Factory that establishes connections passively.
666 ACE_PEER_ACCEPTOR peer_acceptor_
;
668 /// Concurrency strategy for an Acceptor.
669 ACE_Concurrency_Strategy
<SVC_HANDLER
> *concurrency_strategy_
;
671 /// true if Acceptor created the concurrency strategy and thus should
672 /// delete it, else false.
673 bool delete_concurrency_strategy_
;
676 ACE_END_VERSIONED_NAMESPACE_DECL
678 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
679 #include "ace/Acceptor.cpp"
680 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
682 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
683 #pragma implementation ("Acceptor.cpp")
684 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
686 #include /**/ "ace/post.h"
688 #endif /* ACE_ACCEPTOR_H */