summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-04-09 09:15:15 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-04-09 09:15:15 +0000
commitaf128a3939de2eb9357fb7af01d4368780d9d542 (patch)
treece73734961c8345b486f105fd93ae4e84f43256a /ace
parentf0c080fdc364d753e4858872160be9e46c9c72ee (diff)
downloadATCD-af128a3939de2eb9357fb7af01d4368780d9d542.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/Acceptor.cpp23
-rw-r--r--ace/Acceptor.h22
-rw-r--r--ace/Connector.cpp270
-rw-r--r--ace/Connector.h130
-rw-r--r--ace/Hash_Map_Manager.h9
-rw-r--r--ace/Log_Msg.cpp13
-rw-r--r--ace/Map_Manager.h2
-rw-r--r--ace/OS.i4
-rw-r--r--ace/Strategies_T.cpp85
-rw-r--r--ace/Strategies_T.h59
-rw-r--r--ace/Task_T.cpp4
-rw-r--r--ace/config-win32-common.h2
12 files changed, 468 insertions, 155 deletions
diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp
index de394450352..e2ff2f2c3e6 100644
--- a/ace/Acceptor.cpp
+++ b/ace/Acceptor.cpp
@@ -190,11 +190,13 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close (ACE_HANDLE,
// subclass instances of SVC_HANDLER, using a singleton, dynamically
// linking the handler, etc.).
-template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> SVC_HANDLER *
-ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (void)
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
+ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler");
- return new SVC_HANDLER;
+ if (sh == 0)
+ ACE_NEW_RETURN (sh, SVC_HANDLER, -1);
+ return 0;
}
// Bridge method for accepting the new connection into the
@@ -269,9 +271,9 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE listene
// Create a service handler, using the appropriate creation
// strategy.
- SVC_HANDLER *svc_handler = this->make_svc_handler ();
-
- if (svc_handler == 0)
+ SVC_HANDLER *svc_handler = 0;
+
+ if (this->make_svc_handler (svc_handler) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "make_svc_handler"), 0);
// Accept connection into the Svc_Handler.
@@ -478,6 +480,7 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor
const char service_description[])
{
ACE_TRACE ("ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor");
+
if (this->open (addr, reactor, cre_s, acc_s, con_s, sch_s,
service_name, service_description) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"));
@@ -537,11 +540,11 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close (ACE_HANDL
// subclass instances of SVC_HANDLER, using a singleton, dynamically
// linking the handler, etc.).
-template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> SVC_HANDLER *
-ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (void)
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
+ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler");
- return this->creation_strategy_->make_svc_handler ();
+ return this->creation_strategy_->make_svc_handler (sh);
}
// Bridge method for accepting the new connection into the
@@ -892,7 +895,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::fini (void)
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::info (char **strp,
- size_t length) const
+ size_t length) const
{
ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::info");
char buf[BUFSIZ];
diff --git a/ace/Acceptor.h b/ace/Acceptor.h
index feca8eb7d2f..3be451797ad 100644
--- a/ace/Acceptor.h
+++ b/ace/Acceptor.h
@@ -84,12 +84,13 @@ protected:
// for creating, accepting, and activating SVC_HANDLER's,
// respectively.
- virtual SVC_HANDLER *make_svc_handler (void);
+ virtual int make_svc_handler (SVC_HANDLER *&sh);
// Bridge method for creating a SVC_HANDLER. The default is to
- // create a new SVC_HANDLER. However, subclasses can override this
- // policy to perform SVC_HANDLER creation in any way that they like
- // (such as creating subclass instances of SVC_HANDLER, using a
- // singleton, dynamically linking the handler, etc.).
+ // create a new <SVC_HANDLER> if <sh> == 0, else <sh> is unchanged.
+ // However, subclasses can override this policy to perform
+ // SVC_HANDLER creation in any way that they like (such as creating
+ // subclass instances of SVC_HANDLER, using a singleton, dynamically
+ // linking the handler, etc.). Returns -1 on failure, else 0.
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
// Bridge method for accepting the new connection into the
@@ -222,14 +223,15 @@ protected:
// for creating, accepting, and activating <SVC_HANDLER>'s,
// respectively.
- virtual SVC_HANDLER *make_svc_handler (void);
+ virtual int make_svc_handler (SVC_HANDLER *&);
// Bridge method for creating a <SVC_HANDLER>. The strategy for
// creating a <SVC_HANDLER> are configured into the Acceptor via
// it's <creation_strategy_>. The default is to create a new
- // <SVC_HANDLER>. However, subclasses can override this policy to
- // perform <SVC_HANDLER> creation in any way that they like (such as
- // creating subclass instances of <SVC_HANDLER>, using a singleton,
- // dynamically linking the handler, etc.).
+ // <SVC_HANDLER> if <sh> == 0, else <sh> is unchanged. However,
+ // subclasses can override this policy to perform <SVC_HANDLER>
+ // creation in any way that they like (such as creating subclass
+ // instances of <SVC_HANDLER>, using a singleton, dynamically
+ // linking the handler, etc.). Returns -1 on failure, else 0.
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
// Bridge method for accepting the new connection into the
diff --git a/ace/Connector.cpp b/ace/Connector.cpp
index 1660a312d30..00335e83dbf 100644
--- a/ace/Connector.cpp
+++ b/ace/Connector.cpp
@@ -15,20 +15,6 @@
ACE_ALLOC_HOOK_DEFINE(ACE_Connector)
-template <class SH, PR_CO_1> ACE_Reactor *
-ACE_Connector<SH, PR_CO_2>::reactor (void) const
-{
- ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::reactor");
- return this->reactor_;
-}
-
-template <class SH, PR_CO_1> void
-ACE_Connector<SH, PR_CO_2>::reactor (ACE_Reactor *r)
-{
- ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::reactor");
- this->reactor_ = r;
-}
-
template <class SH, PR_CO_1> void
ACE_Connector<SH, PR_CO_2>::dump (void) const
{
@@ -37,14 +23,32 @@ ACE_Connector<SH, PR_CO_2>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->handler_map_.dump ();
this->connector_.dump ();
- ACE_DEBUG ((LM_DEBUG, "reactor_ = %x", this->reactor_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
+// Bridge method for creating a SVC_HANDLER. The strategy for
+// creating a SVC_HANDLER are configured into the Acceptor via it's
+// <creation_strategy_>. The default is to create a new SVC_HANDLER.
+// However, subclasses can override this strategy to perform
+// SVC_HANDLER creation in any way that they like (such as creating
+// subclass instances of SVC_HANDLER, using a singleton, dynamically
+// linking the handler, etc.).
+
+template <class SH, PR_CO_1> int
+ACE_Connector<SH, PR_CO_2>::make_svc_handler (SVC_HANDLER *&sh)
+{
+ ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::make_svc_handler");
+
+ if (sh == 0)
+ ACE_NEW_RETURN (sh, SH, -1);
+ return 0;
+}
+
template <class SH, PR_CO_1> int
ACE_Connector<SH, PR_CO_2>::activate_svc_handler (SVC_HANDLER *svc_handler)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::activate_svc_handler");
+
// We are connected now, so try to open things up.
if (svc_handler->open ((void *) this) == -1)
{
@@ -57,58 +61,19 @@ ACE_Connector<SH, PR_CO_2>::activate_svc_handler (SVC_HANDLER *svc_handler)
}
template <class SH, PR_CO_1> int
-ACE_Connector<SH, PR_CO_2>::connect_svc_handler (SVC_HANDLER *svc_handler,
+ACE_Connector<SH, PR_CO_2>::connect_svc_handler (SVC_HANDLER *&svc_handler,
const PR_AD &remote_addr,
- const ACE_Synch_Options &synch_options,
+ ACE_Time_Value *timeout,
const PR_AD &local_addr,
int reuse_addr,
int flags,
int perms)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::connect_svc_handler");
- // 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->connector_.connect (svc_handler->peer (),
- remote_addr,
- timeout,
- local_addr,
- reuse_addr,
- flags,
- perms) == -1)
- {
- if (use_reactor && errno == EWOULDBLOCK)
- {
- // If the connection hasn't completed and we are using
- // non-blocking semantics then register ourselves with the
- // ACE_Reactor so that it will call us back when the
- // connection is complete or we timeout, whichever comes
- // first... Note that we needn't check the return value
- // here because if something goes wrong that will reset
- // errno this will be detected by the caller (since -1 is
- // being returned...).
- this->create_AST (svc_handler, synch_options);
- }
- else
- // Make sure to close down the Channel to avoid descriptor leaks.
- svc_handler->close (0);
- return -1;
- }
- else
- // Activate immediately if we are connected.
- return this->activate_svc_handler (svc_handler);
+ return this->connector_.connect (svc_handler->peer (), remote_addr,
+ timeout, local_addr,
+ reuse_addr, flags, perms);
}
template <class SH, PR_CO_1> ACE_PEER_CONNECTOR &
@@ -119,10 +84,10 @@ ACE_Connector<SH, PR_CO_2>::connector (void) const
}
template <class SH, PR_CO_1> int
-ACE_Connector<SH, PR_CO_2>::open (ACE_Reactor *reactor)
+ACE_Connector<SH, PR_CO_2>::open (ACE_Reactor *r)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::open");
- this->reactor_ = reactor;
+ this->reactor (r);
this->closing_ = 0;
return 0;
}
@@ -212,10 +177,10 @@ ACE_Svc_Tuple<SH>::dump (void) const
}
template <class SH, PR_CO_1>
-ACE_Connector<SH, PR_CO_2>::ACE_Connector (ACE_Reactor *reactor)
- : reactor_ (reactor)
+ACE_Connector<SH, PR_CO_2>::ACE_Connector (ACE_Reactor *r)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::ACE_Connector");
+ this->reactor (r);
}
// This method is called if a connection times out before completing.
@@ -267,10 +232,10 @@ ACE_Connector<SH, PR_CO_2>::cleanup_AST (ACE_HANDLE handle,
// Try to remove from ACE_Timer_Queue but if it's not there we
// ignore the error.
- this->reactor_->cancel_timer (ast->cancellation_id ());
+ this->reactor ()->cancel_timer (ast->cancellation_id ());
// Remove ACE_HANDLE from ACE_Reactor.
- this->reactor_->remove_handler
+ this->reactor ()->remove_handler
(handle, ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL);
// Remove ACE_HANDLE from the map.
@@ -330,7 +295,7 @@ ACE_Connector<SH, PR_CO_2>::handle_output (ACE_HANDLE handle)
// Initiate connection to peer.
template <class SH, PR_CO_1> int
-ACE_Connector<SH, PR_CO_2>::connect (SH *sh,
+ACE_Connector<SH, PR_CO_2>::connect (SH *&sh,
const PR_AD &remote_addr,
const ACE_Synch_Options &synch_options,
const PR_AD &local_addr,
@@ -339,11 +304,47 @@ ACE_Connector<SH, PR_CO_2>::connect (SH *sh,
int perms)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::connect");
+
+ // If the user hasn't supplied us with a <SVC_HANDLER> we'll use the
+ // factory method to create one. Otherwise, things will remain as
+ // they are...
+ if (this->make_svc_handler (sh) == -1)
+ return -1;
+
+ 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 ();
+
// Delegate to connection strategy.
- return this->connect_svc_handler (sh, remote_addr, synch_options,
- local_addr, reuse_addr,
- flags, perms);
-
+ if (this->connect_svc_handler (sh, remote_addr, timeout,
+ local_addr, reuse_addr,
+ flags, perms) == -1)
+ {
+ if (use_reactor && errno == EWOULDBLOCK)
+ {
+ // If the connection hasn't completed and we are using
+ // non-blocking semantics then register ourselves with the
+ // ACE_Reactor so that it will call us back when the
+ // connection is complete or we timeout, whichever comes
+ // first... Note that we needn't check the return value
+ // here because if something goes wrong that will reset
+ // errno this will be detected by the caller (since -1 is
+ // being returned...).
+ this->create_AST (sh, synch_options);
+ }
+ else
+ // Make sure to close down the Channel to avoid descriptor
+ // leaks.
+ sh->close (0);
+ return -1;
+ }
+ else
+ // Activate immediately if we are connected.
+ return this->activate_svc_handler (sh);
}
// Cancel a <svc_handler> that was started asynchronously.
@@ -382,9 +383,9 @@ ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh,
// Register this with the reactor for both reading and writing
// events.
- if (this->reactor_->register_handler (this,
- ACE_Event_Handler::READ_MASK
- | ACE_Event_Handler::WRITE_MASK) == -1)
+ if (this->reactor ()->register_handler (this,
+ ACE_Event_Handler::READ_MASK
+ | ACE_Event_Handler::WRITE_MASK) == -1)
goto fail1;
// Bind ACE_Svc_Tuple with the ACE_HANDLE we're trying to connect.
@@ -399,9 +400,8 @@ ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh,
if (tv != 0)
{
int cancellation_id =
- this->reactor_->schedule_timer (this,
- (const void *) ast,
- *tv);
+ this->reactor ()->schedule_timer
+ (this, (const void *) ast, *tv);
if (cancellation_id == -1)
goto fail3;
@@ -423,10 +423,10 @@ fail3:
this->handler_map_.unbind (this->get_handle ());
/* FALLTHRU */
fail2:
- this->reactor_->remove_handler (this,
- ACE_Event_Handler::READ_MASK
- | ACE_Event_Handler::WRITE_MASK
- | ACE_Event_Handler::DONT_CALL);
+ this->reactor ()->remove_handler (this,
+ ACE_Event_Handler::READ_MASK
+ | ACE_Event_Handler::WRITE_MASK
+ | ACE_Event_Handler::DONT_CALL);
/* FALLTHRU */
fail1:
delete ast;
@@ -444,7 +444,7 @@ ACE_Connector<SH, PR_CO_2>::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::handle_close");
- if (this->reactor_ != 0 && this->closing_ == 0)
+ if (this->reactor () != 0 && this->closing_ == 0)
{
// We're closing down now, so make sure not to call ourselves
// recursively via other calls to handle_close() (e.g., from the
@@ -453,7 +453,7 @@ ACE_Connector<SH, PR_CO_2>::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask)
// Remove all timer objects associated with <this> object from
// the <Reactor>'s Timer_Queue.
- this->reactor_->cancel_timer (this);
+ this->reactor ()->cancel_timer (this);
MAP_ITERATOR mi (this->handler_map_);
@@ -463,8 +463,8 @@ ACE_Connector<SH, PR_CO_2>::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask)
mi.next (me) != 0;
mi.advance ())
{
- this->reactor_->remove_handler (me->ext_id_,
- mask | ACE_Event_Handler::DONT_CALL);
+ this->reactor ()->remove_handler (me->ext_id_,
+ mask | ACE_Event_Handler::DONT_CALL);
AST *ast = 0;
this->cleanup_AST (me->ext_id_, ast);
@@ -538,6 +538,108 @@ ACE_Connector<SH, PR_CO_2>::~ACE_Connector (void)
this->handle_close ();
}
+template <class SH, PR_CO_1> int
+ACE_Strategy_Connector<SH, PR_CO_2>::open
+ (ACE_Reactor *r,
+ ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
+ ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s,
+ ACE_Concurrency_Strategy<SVC_HANDLER> *con_s)
+{
+ ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::open");
+
+ this->reactor (r);
+
+ // Initialize the creation strategy.
+
+ if (cre_s == 0)
+ {
+ ACE_NEW_RETURN (cre_s, CREATION_STRATEGY, -1);
+ this->delete_creation_strategy_ = 1;
+ }
+ this->creation_strategy_ = cre_s;
+
+ // Initialize the accept strategy.
+
+ if (conn_s == 0)
+ {
+ ACE_NEW_RETURN (conn_s, CONNECT_STRATEGY, -1);
+ this->delete_connect_strategy_ = 1;
+ }
+ this->connect_strategy_ = conn_s;
+
+ // Initialize the concurrency strategy.
+
+ if (con_s == 0)
+ {
+ ACE_NEW_RETURN (con_s, CONCURRENCY_STRATEGY, -1);
+ this->delete_concurrency_strategy_ = 1;
+ }
+ this->concurrency_strategy_ = con_s;
+
+ return 0;
+}
+
+template <class SH, PR_CO_1>
+ACE_Strategy_Connector<SH, PR_CO_2>::ACE_Strategy_Connector
+ (ACE_Reactor *reactor,
+ ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
+ ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s,
+ ACE_Concurrency_Strategy<SVC_HANDLER> *con_s)
+{
+ ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::ACE_Connector");
+
+ if (this->open (reactor, cre_s, conn_s, con_s) == -1)
+ ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Strategy_Connector::ACE_Strategy_Connector"));
+}
+
+template <class SH, PR_CO_1>
+ACE_Strategy_Connector<SH, PR_CO_2>::~ACE_Strategy_Connector (void)
+{
+ ACE_TRACE ("ACE_Strategy_Connector<SH, PR_CO_2>::~ACE_Strategy_Connector");
+
+ if (this->delete_creation_strategy_)
+ delete this->creation_strategy_;
+ this->delete_creation_strategy_ = 0;
+ this->creation_strategy_ = 0;
+
+ if (this->delete_connect_strategy_)
+ delete this->connect_strategy_;
+ this->delete_connect_strategy_ = 0;
+ this->connect_strategy_ = 0;
+
+ if (this->delete_concurrency_strategy_)
+ delete this->concurrency_strategy_;
+ this->delete_concurrency_strategy_ = 0;
+ this->concurrency_strategy_ = 0;
+}
+
+template <class SH, PR_CO_1> int
+ACE_Strategy_Connector<SH, PR_CO_2>::make_svc_handler (SVC_HANDLER *&sh)
+{
+ return this->creation_strategy_->make_svc_handler (sh);
+}
+
+template <class SH, PR_CO_1> int
+ACE_Strategy_Connector<SH, PR_CO_2>::connect_svc_handler
+ (SVC_HANDLER *&sh,
+ const ACE_PEER_CONNECTOR_ADDR &remote_addr,
+ ACE_Time_Value *timeout,
+ const ACE_PEER_CONNECTOR_ADDR &local_addr,
+ int reuse_addr,
+ int flags,
+ int perms)
+{
+ return this->connect_strategy_->connect_svc_handler (sh, remote_addr,
+ timeout, local_addr,
+ reuse_addr, flags, perms);
+}
+
+template <class SH, PR_CO_1> int
+ACE_Strategy_Connector<SH, PR_CO_2>::activate_svc_handler (SVC_HANDLER *svc_handler)
+{
+ return this->concurrency_strategy_->activate_svc_handler (svc_handler);
+}
+
#undef SH
#undef PR_CO_1
#undef PR_CO_2
diff --git a/ace/Connector.h b/ace/Connector.h
index 7c394145993..05513ca5968 100644
--- a/ace/Connector.h
+++ b/ace/Connector.h
@@ -116,12 +116,12 @@ public:
virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor ());
// Initialize a connector.
- ~ACE_Connector (void);
+ virtual ~ACE_Connector (void);
// Shutdown a connector and release resources.
// = Connection establishment method
- virtual int connect (SVC_HANDLER *svc_handler,
+ virtual int connect (SVC_HANDLER *&svc_handler,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults,
const ACE_PEER_CONNECTOR_ADDR &local_addr
@@ -143,12 +143,6 @@ public:
ACE_PEER_CONNECTOR &connector (void) const;
// Return the underlying PEER_CONNECTOR object.
- ACE_Reactor *reactor (void) const;
- // Get the underlying Reactor *.
-
- void reactor (ACE_Reactor *);
- // Set the underlying Reactor *.
-
void dump (void) const;
// Dump the state of an object.
@@ -172,18 +166,27 @@ protected:
#endif /* ACE_MT_SAFE */
// = The following two methods define the Connector's strategies for
- // connecting and activating SVC_HANDLER's, respectively.
-
- virtual int connect_svc_handler (SVC_HANDLER *svc_handler,
+ // creating, connecting, and activating SVC_HANDLER's, respectively.
+
+ virtual int make_svc_handler (SVC_HANDLER *&sh);
+ // Bridge method for creating a SVC_HANDLER. The default is to
+ // create a new SVC_HANDLER only if <sh> == 0, else <sh> is
+ // unchanged. However, subclasses can override this policy to
+ // perform SVC_HANDLER creation in any way that they like (such as
+ // creating subclass instances of SVC_HANDLER, using a singleton,
+ // dynamically linking the handler, etc.). Returns -1 if failure,
+ // else 0.
+
+ virtual int connect_svc_handler (SVC_HANDLER *&svc_handler,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
- const ACE_Synch_Options &synch_options,
+ ACE_Time_Value *timeout,
const ACE_PEER_CONNECTOR_ADDR &local_addr,
int reuse_addr,
int flags,
int perms);
// Bridge method for connecting the <svc_handler> to the
// <remote_addr>. The default behavior delegates to the
- // PEER_CONNECTOR::connect.
+ // <PEER_CONNECTOR::connect>.
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
// Bridge method for activating a <svc_handler> with the appropriate
@@ -254,14 +257,109 @@ private:
ACE_PEER_CONNECTOR connector_;
// Factor that establishes connections actively.
- ACE_Reactor *reactor_;
- // Event demultiplex associated with this object.
-
char closing_;
// Keeps track of whether we are in the process of closing (required
// to avoid circular calls to <handle_close>).
};
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
+class ACE_Strategy_Connector : public ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2>
+ // = TITLE
+ // Abstract factory for creating a service handler
+ // (SVC_HANDLER), connecting the SVC_HANDLER, and activating the
+ // SVC_HANDLER.
+ //
+ // = DESCRIPTION
+ // Implements a flexible and extensible set of strategies for
+ // actively establishing connections with clients. There are
+ // three main strategies: (1) creating a SVC_HANDLER, (2)
+ // actively connecting a new connection from a client into the
+ // SVC_HANDLER, and (3) activating the SVC_HANDLER with a
+ // particular concurrency mechanism.
+{
+public:
+ ACE_Strategy_Connector (ACE_Reactor *r = ACE_Service_Config::reactor (),
+ ACE_Creation_Strategy<SVC_HANDLER> * = 0,
+ ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
+ ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
+ // Initialize a connector.
+
+ virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor (),
+ ACE_Creation_Strategy<SVC_HANDLER> * = 0,
+ ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
+ ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
+ // Initialize a connector.
+
+ virtual ~ACE_Strategy_Connector (void);
+ // Shutdown a connector and release resources.
+
+protected:
+ // = The following three methods define the <Connector>'s strategies
+ // for creating, connecting, and activating <SVC_HANDLER>'s,
+ // respectively.
+
+ virtual int make_svc_handler (SVC_HANDLER *&sh);
+ // Bridge method for creating a <SVC_HANDLER>. The strategy for
+ // creating a <SVC_HANDLER> are configured into the Connector via
+ // it's <creation_strategy_>. The default is to create a new
+ // <SVC_HANDLER> only if <sh> == 0, else <sh> is unchanged.
+ // However, subclasses can override this policy to perform
+ // <SVC_HANDLER> creation in any way that they like (such as
+ // creating subclass instances of <SVC_HANDLER>, using a singleton,
+ // dynamically linking the handler, etc.). Returns -1 if failure,
+ // else 0.
+
+ virtual int connect_svc_handler (SVC_HANDLER *&sh,
+ const ACE_PEER_CONNECTOR_ADDR &remote_addr,
+ ACE_Time_Value *timeout,
+ const ACE_PEER_CONNECTOR_ADDR &local_addr,
+ int reuse_addr,
+ int flags,
+ int perms);
+ // Bridge method for connecting the new connection into the
+ // <SVC_HANDLER>. The default behavior delegates to the
+ // <PEER_CONNECTOR::connect> in the <Connect_Strategy>.
+
+ virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+ // Bridge method for activating a <SVC_HANDLER> with the appropriate
+ // concurrency strategy. The default behavior of this method is to
+ // activate the <SVC_HANDLER> by calling its <open> method (which
+ // allows the <SVC_HANDLER> to define its own concurrency strategy).
+ // 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).
+
+ // = Define some useful typedefs.
+ typedef ACE_Creation_Strategy<SVC_HANDLER> CREATION_STRATEGY;
+ typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> CONNECT_STRATEGY;
+ typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY;
+
+ // = Strategy objects.
+
+ CREATION_STRATEGY *creation_strategy_;
+ // Creation strategy for an <Connector>.
+
+ int delete_creation_strategy_;
+ // 1 if <Connector> created the creation strategy and thus should
+ // delete it, else 0.
+
+ CONNECT_STRATEGY *connect_strategy_;
+ // Connect strategy for a <Connector>.
+
+ int delete_connect_strategy_;
+ // 1 if <Connector> created the connect strategy and thus should
+ // delete it, else 0.
+
+ CONCURRENCY_STRATEGY *concurrency_strategy_;
+ // Concurrency strategy for an <Connector>.
+
+ int delete_concurrency_strategy_;
+ // 1 if <Connector> created the concurrency strategy and thus should
+ // delete it, else 0.
+
+};
+
#include "ace/Connector.i"
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h
index 3a197cf1482..3800b241b0f 100644
--- a/ace/Hash_Map_Manager.h
+++ b/ace/Hash_Map_Manager.h
@@ -99,10 +99,9 @@ public:
INT_ID &int_id);
// Associate <ext_id> with <int_id> if and only if <ext_id> is not
// in the map. If <ext_id> is already in the map then the <int_id>
- // parameter is overwritten with the existing value in the map
- // Returns 0 if a new entry is bound successfully, returns 1 if an
- // attempt is made to bind an existing entry, and returns -1 if
- // failures occur.
+ // parameter is assigned the existing value in the map. Returns 0
+ // if a new entry is bound successfully, returns 1 if an attempt is
+ // made to bind an existing entry, and returns -1 if failures occur.
int bind (const EXT_ID &item,
const INT_ID &int_id);
@@ -127,7 +126,7 @@ public:
int find (const EXT_ID &item,
INT_ID &int_id);
// Locate <ext_id> and pass out parameter via <int_id>. If found,
- // return 0, returns -1 if failure occurs.
+ // return 0, returns -1 if not found.
int find (const EXT_ID &ext_id);
// Returns 0 if the <ext_id> is in the mapping, otherwise -1.
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index d83cda21e06..4cf2182c8bf 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -93,6 +93,14 @@ private:
#endif /* VXWORKS */
};
+#if defined (ACE_HAS_SIG_C_FUNC)
+extern "C" void
+ace_log_msg_atexit (void)
+{
+ ACE_Log_Msg_Manager::atexit ();
+}
+#endif /* ACE_HAS_SIG_C_FUNC */
+
ACE_Thread_Mutex *ACE_Log_Msg_Manager::lock_ = 0;
ACE_Thread_Mutex *
@@ -268,8 +276,13 @@ ACE_Log_Msg::instance (void)
return 0; // Major problems, this should *never* happen!
}
}
+
// Register cleanup handler.
+#if defined (ACE_HAS_SIG_C_FUNC)
+ ::atexit (ace_log_msg_atexit);
+#else
::atexit (ACE_Log_Msg_Manager::atexit);
+#endif /* ACE_HAS_SIG_C_FUNC */
key_created_ = 1;
}
ACE_OS::thread_mutex_unlock (&lock);
diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h
index bbc7ba71010..11e388dd5bb 100644
--- a/ace/Map_Manager.h
+++ b/ace/Map_Manager.h
@@ -123,7 +123,7 @@ public:
int find (const EXT_ID &ext_id, INT_ID &int_id);
// Locate <ext_id> and pass out parameter via <int_id>. If found,
- // return 0, returns -1 if failure occurs.
+ // return 0, returns -1 if not found.
int find (const EXT_ID &ext_id);
// Returns 0 if the <ext_id> is in the mapping, otherwise -1.
diff --git a/ace/OS.i b/ace/OS.i
index bdc1c92e5f8..2361269b554 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1574,7 +1574,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
// unfairness.
ACE_OSCALL (ACE_ADAPT_RETVAL (::SignalObjectAndWait (cv->waiters_done_,
external_mutex->proc_mutex_,
- cv->sema_, INFINITE, FALSE),
+ INFINITE, FALSE),
result),
int, -1, result);
else
@@ -1690,7 +1690,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// unfairness.
ACE_OSCALL (ACE_ADAPT_RETVAL (::SignalObjectAndWait (cv->waiters_done_,
external_mutex->proc_mutex_,
- cv->sema_, INFINITE, FALSE),
+ INFINITE, FALSE),
result),
int, -1, result);
else
diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp
index 9772ce6f0c9..7716ae84a15 100644
--- a/ace/Strategies_T.cpp
+++ b/ace/Strategies_T.cpp
@@ -46,11 +46,12 @@ ACE_Singleton_Strategy<SVC_HANDLER>::~ACE_Singleton_Strategy (void)
// Create a Singleton SVC_HANDLER by always returning the same
// SVC_HANDLER.
-template <class SVC_HANDLER> SVC_HANDLER *
-ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler (void)
+template <class SVC_HANDLER> int
+ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler");
- return this->svc_handler_;
+ sh = this->svc_handler_;
+ return 0;
}
ACE_ALLOC_HOOK_DEFINE(ACE_Creation_Strategy)
@@ -80,11 +81,14 @@ ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy (ACE_Thread_Manager *t
// Default behavior is to make a new SVC_HANDLER, passing in the
// Thread_Manager (if any).
-template <class SVC_HANDLER> SVC_HANDLER *
-ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler (void)
+template <class SVC_HANDLER> int
+ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
- return new SVC_HANDLER (this->thr_mgr_);
+
+ if (sh == 0)
+ ACE_NEW_RETURN (sh, SVC_HANDLER (this->thr_mgr_), -1);
+ return 0;
}
template <class SVC_HANDLER>
@@ -130,20 +134,22 @@ ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (void)
// Create a SVC_HANDLER by dynamically linking it from a DLL.
-template <class SVC_HANDLER> SVC_HANDLER *
-ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (void)
+template <class SVC_HANDLER> int
+ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler");
// Open the shared library.
void *handle = (void *) ACE_OS::dlopen (this->shared_library_);
// Extract the factory function.
- SVC_HANDLER *(*factory)(void) = (SVC_HANDLER *(*)(void)) ACE_OS::dlsym (handle,
- this->factory_function_);
+ SVC_HANDLER *(*factory)(void) = (SVC_HANDLER *(*)(void)) ACE_OS::dlsym
+ (handle, this->factory_function_);
// Call the factory function to obtain the new SVC_Handler (should
// use RTTI here when it becomes available...)
- SVC_HANDLER *svc_handler = (*factory)();
+ SVC_HANDLER *svc_handler;
+
+ ACE_ALLOCATOR_RETURN (svc_handler, (*factory)(), -1);
if (svc_handler != 0)
{
@@ -154,7 +160,8 @@ ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (void)
// @@ Somehow, we need to deal with this->thr_mgr_...
}
- return svc_handler;
+ sh = svc_handler;
+ return 0;
}
ACE_ALLOC_HOOK_DEFINE(ACE_Concurrency_Strategy)
@@ -270,7 +277,7 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open
(const ACE_PEER_ACCEPTOR_ADDR &local_addr, int restart)
{
- return this->peer_acceptor_.open (local_addr, restart);
+ return this->acceptor_.open (local_addr, restart);
}
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> void
@@ -291,7 +298,7 @@ ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler");
- if (this->peer_acceptor_.accept (svc_handler->peer ()) == -1)
+ if (this->acceptor_.accept (svc_handler->peer ()) == -1)
{
svc_handler->close (0);
return -1;
@@ -304,24 +311,68 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_HANDLE
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle (void) const
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle");
- return this->peer_acceptor_.get_handle ();
+ return this->acceptor_.get_handle ();
}
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_PEER_ACCEPTOR &
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor (void) const
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor");
- return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_;
+ return (ACE_PEER_ACCEPTOR &) this->acceptor_;
}
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy (void)
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy");
- if (this->peer_acceptor_.close () == -1)
+
+ if (this->acceptor_.close () == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "close"));
}
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> void
+ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::dump (void) const
+{
+ ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::dump");
+}
+
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int
+ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler
+ (SVC_HANDLER *&sh,
+ const ACE_PEER_CONNECTOR_ADDR &remote_addr,
+ ACE_Time_Value *timeout,
+ const ACE_PEER_CONNECTOR_ADDR &local_addr,
+ int reuse_addr,
+ int flags,
+ int perms)
+{
+ ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler");
+
+ return this->connector_.connect (sh->peer (), remote_addr,
+ timeout, local_addr,
+ reuse_addr, flags, perms);
+}
+
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_PEER_CONNECTOR &
+ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector (void) const
+{
+ ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector");
+ return (ACE_PEER_CONNECTOR &) this->connector_;
+}
+
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
+ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy (void)
+{
+ ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy");
+}
+
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
+ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connect_Strategy (void)
+{
+ ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connect_Strategy");
+}
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Connect_Strategy)
ACE_ALLOC_HOOK_DEFINE(ACE_Process_Strategy)
template <class SVC_HANDLER> void
diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h
index 2f130f263aa..2868c8fe02e 100644
--- a/ace/Strategies_T.h
+++ b/ace/Strategies_T.h
@@ -18,6 +18,7 @@
#define ACE_STRATEGIES_T_H
#include "ace/Service_Config.h"
+#include "ace/Synch_Options.h"
template <class SVC_HANDLER>
class ACE_Creation_Strategy
@@ -44,10 +45,11 @@ public:
virtual ~ACE_Creation_Strategy (void);
// = Factory method.
- virtual SVC_HANDLER *make_svc_handler (void);
+ virtual int make_svc_handler (SVC_HANDLER *&sh);
// Create a SVC_HANDLER with the appropriate creation strategy. The
- // default behavior of this method is to make a new SVC_HANDLER,
- // passing in the Thread_Manager (if any).
+ // default behavior of this method is to make a new <SVC_HANDLER> if
+ // <sh> == 0 (passing in the <Thread_Manager>), else <sh> is
+ // unchanged. Returns -1 on failure, else 0.
void dump (void) const;
// Dump the state of an object.
@@ -80,9 +82,9 @@ public:
virtual ~ACE_Singleton_Strategy (void);
// = Factory method.
- virtual SVC_HANDLER *make_svc_handler (void);
+ virtual int make_svc_handler (SVC_HANDLER *&);
// Create a Singleton SVC_HANDLER by always returning the same
- // SVC_HANDLER.
+ // SVC_HANDLER. Returns -1 on failure, else 0.
void dump (void) const;
// Dump the state of an object.
@@ -120,8 +122,9 @@ public:
// information contained in the <svc_dll_info> string.
// = Factory method.
- virtual SVC_HANDLER *make_svc_handler (void);
+ virtual int make_svc_handler (SVC_HANDLER *&);
// Create a SVC_HANDLER by dynamically linking it from a DLL.
+ // Returns -1 on failure, else 0.
void dump (void) const;
// Dump the state of an object.
@@ -323,10 +326,52 @@ public:
// Declare the dynamic allocation hooks.
protected:
- ACE_PEER_ACCEPTOR peer_acceptor_;
+ ACE_PEER_ACCEPTOR acceptor_;
// Factory that establishes connections passively.
};
+template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
+class ACE_Connect_Strategy
+ // = TITLE
+ // Defines the interface for specifying an active
+ // connection establishment strategy for a SVC_HANDLER.
+ //
+ // = DESCRIPTION
+ // This class provides a strategy that manages active
+ // connection establishment to a server.
+{
+public:
+ // = Initialization and termination methods.
+ ACE_Connect_Strategy (void);
+ // Default constructor.
+
+ virtual ACE_PEER_CONNECTOR &connector (void) const;
+ // Return a reference to the <peer_connector_>.
+
+ virtual ~ACE_Connect_Strategy (void);
+
+ // = Factory method.
+ virtual int connect_svc_handler (SVC_HANDLER *&sh,
+ const ACE_PEER_CONNECTOR_ADDR &remote_addr,
+ ACE_Time_Value *timeout,
+ const ACE_PEER_CONNECTOR_ADDR &local_addr,
+ int reuse_addr,
+ int flags,
+ int perms);
+ // The default behavior delegates to the <connect> method of the
+ // <PEER_CONNECTOR::connect>.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+protected:
+ ACE_PEER_CONNECTOR connector_;
+ // Factory that establishes connections actively.
+};
+
template <class SVC_HANDLER>
class ACE_Scheduling_Strategy
// = TITLE
diff --git a/ace/Task_T.cpp b/ace/Task_T.cpp
index 898306a9136..dbeee24fbed 100644
--- a/ace/Task_T.cpp
+++ b/ace/Task_T.cpp
@@ -6,9 +6,9 @@
#define ACE_BUILD_DLL
#include "ace/Task_T.h"
-#if !defined(HPUX) || defined(__GNUG_)
+#if !defined (HPUX) || defined (__GNUG_) || defined (ACE_HAS_BROKEN_HPUX_TEMPLATES)
#include "ace/Module.h"
-#endif /* !defined(HPUX) || defined(__GNUG__) */
+#endif /* !defined (HPUX) || defined (__GNUG__) || defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) */
#include "ace/Service_Config.h"
#if !defined (__ACE_INLINE__)
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index 921cd42217c..99dc2912203 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -249,7 +249,7 @@
#if !defined (_WINSOCK2API_)
#include /**/ <winsock2.h> /* will also include windows.h, if not present */
-
+ #include <mswsock.h>
#if defined (_MSC_VER)
#pragma comment(lib, "ws2_32.lib")
#endif /* _MSC_VER */