summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Cleeland <chris.cleeland@gmail.com>1997-05-16 23:01:39 +0000
committerChris Cleeland <chris.cleeland@gmail.com>1997-05-16 23:01:39 +0000
commit917c1162363149b612ec80b8d5efe16bb09d86c5 (patch)
treeecb84a4147af96dacbc76fb95e1ad9da0c081971
parentf32b9b7f53db37d16a5cd4949fca308229d1281b (diff)
downloadATCD-917c1162363149b612ec80b8d5efe16bb09d86c5.tar.gz
Stuff compiles, but haven't tested it.
-rw-r--r--TAO/ChangeLog-98c66
-rw-r--r--TAO/IIOP/lib/any.cpp1
-rw-r--r--TAO/IIOP/lib/boa.cpp27
-rw-r--r--TAO/IIOP/lib/cdr.cpp1
-rw-r--r--TAO/IIOP/lib/connect.cpp28
-rw-r--r--TAO/IIOP/lib/connmgr.cpp785
-rw-r--r--TAO/IIOP/lib/connmgr.h153
-rw-r--r--TAO/IIOP/lib/debug.cpp17
-rw-r--r--TAO/IIOP/lib/debug.h24
-rw-r--r--TAO/IIOP/lib/factories.cpp37
-rw-r--r--TAO/IIOP/lib/factories.h11
-rw-r--r--TAO/IIOP/lib/factories.i6
-rw-r--r--TAO/IIOP/lib/giop.cpp184
-rw-r--r--TAO/IIOP/lib/giop.h34
-rw-r--r--TAO/IIOP/lib/iiopobj.h4
-rw-r--r--TAO/IIOP/lib/iiopobj.i8
-rw-r--r--TAO/IIOP/lib/iioporb.cpp2
-rw-r--r--TAO/IIOP/lib/iioporb.h4
-rw-r--r--TAO/IIOP/lib/iioporb.i12
-rw-r--r--TAO/IIOP/lib/invoke.cpp21
-rw-r--r--TAO/IIOP/lib/object.cpp16
-rw-r--r--TAO/IIOP/lib/objtable.cpp5
-rw-r--r--TAO/IIOP/lib/optable.h4
-rw-r--r--TAO/IIOP/lib/orbobj.cpp26
-rw-r--r--TAO/IIOP/lib/orbobj.i23
-rw-r--r--TAO/IIOP/lib/params.h5
-rw-r--r--TAO/IIOP/lib/params.i4
-rw-r--r--TAO/IIOP/lib/request.cpp11
-rw-r--r--TAO/IIOP/lib/roa.cpp4
-rw-r--r--TAO/IIOP/lib/stub.h23
-rw-r--r--TAO/IIOP/lib/svrrqst.cpp15
-rw-r--r--TAO/IIOP/lib/svrrqst.h21
-rw-r--r--TAO/IIOP/lib/svrrqst.i13
-rw-r--r--TAO/IIOP/lib/thread.h200
-rw-r--r--TAO/IIOP/lib/typecode.cpp19
35 files changed, 410 insertions, 1404 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 664698faeee..ae7d472e807 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,69 @@
+Fri May 16 17:30:31 1997 Chris Cleeland <cleeland@cs.wustl.edu>
+
+ * IIOP/lib/svrrqst.*: Corrected some comments, adjusted some
+ argument type names to reflect their new, namespace-sanitized
+ names, and moved short methods into a new inline file.
+
+ * IIOP/lib/stub.h: Corrected some comments and adjusted some
+ argument type names to reflect their new, namespace-sanitized
+ names.
+
+ * IIOP/lib/roa.cpp: Corrected syntax error and fixed up typedef.
+
+ * IIOP/lib/params.*: Removed extraneous comments and fixed
+ argument type on demux_strategy().
+
+ * IIOP/lib/orbobj.*: Added comments, removed static pointer to
+ the ORB.
+
+ * IIOP/lib/optable.h: Removed extraneous comments and fixed
+ typedefs.
+
+ * IIOP/lib/objtable.cpp: Fixed some syntax errors introduced by
+ reformating.
+
+ * IIOP/lib/object.cpp: Adjusted some argument type names to
+ reflect their new, namespace-sanitized names.
+
+ * IIOP/lib/invoke.cpp: Removed crufty #includes and adjusted some
+ argument type names to reflect their new, namespace-sanitized
+ names.
+
+ * IIOP/lib/iioporb.*: Moved short methods into inline file, added
+ IIOP_ORB_ptr typedef, and changed data member to conform to ace
+ standards.
+
+ * IIOP/lib/iiopobj.*: Added the second CTOR that I forgot last
+ time and adjusted some argument type names to reflect their new,
+ namespace-sanitized names.
+
+ * IIOP/lib/giop.h: Added comments for various enums and
+ structures.
+
+ * IIOP/lib/giop.cpp: Switched various GIOP::Invocation methods to
+ use handler_->peer() for socket communication rather than going
+ through a file descriptor. Also began the arduous (no other word
+ could explain it!) process of converting the homegrown debugging
+ message macro uses into ACE_DEBUG() uses.
+
+ * IIOP/lib/factories.*: Added explicit DTOR for TAO_Client_Factory
+ and completed all the darn explicit template instantiations.
+ Changed 'Svc_Handler' to 'TAO_Client_Connection_Handler', and
+ added the forgotton TAO_Client_Factory::connector() method.
+
+ * IIOP/lib/debug.*: Added 'TAO_' prefix to global debug state
+ variables and removed crufty #includes.
+
+ * IIOP/lib/connect.cpp: Change ROA_Handler to
+ TOA_OA_Connection_Handler (missed these the last time through).
+
+ * IIOP/lib/cdr.cpp: Added responsive commentary.
+
+ * IIOP/lib/boa.cpp: Added comments to the dispatching code.
+
+ * IIOP/lib/{any,boa,request,typecode}.cpp: Removed references to
+ thread.h/connmgr.*.
+
Thu May 15 19:08:16 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu>
* Finished updating all the reformatting.
diff --git a/TAO/IIOP/lib/any.cpp b/TAO/IIOP/lib/any.cpp
index fa2a88eba5f..ac50068f043 100644
--- a/TAO/IIOP/lib/any.cpp
+++ b/TAO/IIOP/lib/any.cpp
@@ -38,7 +38,6 @@
#include <orb.h>
#include "debug.h"
-#include "thread.h"
#include <initguid.h>
diff --git a/TAO/IIOP/lib/boa.cpp b/TAO/IIOP/lib/boa.cpp
index 681c1c5a6a4..5faf3f05b9b 100644
--- a/TAO/IIOP/lib/boa.cpp
+++ b/TAO/IIOP/lib/boa.cpp
@@ -10,23 +10,22 @@
// the modules knowing about IIOP. In the future, a looser coupling
// between OA initialiszation and protocol components is desired.
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
-#include <orb.h>
-#include <boa.h>
+#include <orb.h>
+#include <boa.h>
-#include "thread.h"
-#include "debug.h"
+#include "debug.h"
// XXX this should not know implementation or other details of any
// protocol modules! This is an implementation shortcut only.
-#include "iioporb.h"
-#include "roa.h"
+#include "iioporb.h"
+#include "roa.h"
-#include <initguid.h>
+#include <initguid.h>
// {A201E4C8-F258-11ce-9598-0000C07CA898}
@@ -164,12 +163,16 @@ void CORBA_BOA::dispatch (CORBA_OctetSeq &key,
// @@ Please add more comments here. This is a very important part
// of the code.
+ // Find the object based on the key
if (this->find (key, obj) != -1)
{
opname = req.op_name ();
- if (obj->find (opname, skel) != -1)
- skel (req, obj, env); // really should be scheduled .
+ // Find the skeleton "glue" function based on the operation name
+ if (obj->find (opname, skel) != -1)
+ // Schedule the upcall. This is the degenerate case of scheduling...
+ // using a "do it now!" scheduler
+ skel (req, obj, env);
else
{
// this may fail in which case, we must try out the default
diff --git a/TAO/IIOP/lib/cdr.cpp b/TAO/IIOP/lib/cdr.cpp
index efc8c525e82..c22e4643383 100644
--- a/TAO/IIOP/lib/cdr.cpp
+++ b/TAO/IIOP/lib/cdr.cpp
@@ -399,6 +399,7 @@ CDR::grow (size_t newsize)
if (newsize == 0)
{
// @@ Can we replace the magic number 4096 with a const or enum?
+ // I defer to Andy on this since he has much more experience... --cjc
if (length < 4096)
new_len = length + 4096;
else
diff --git a/TAO/IIOP/lib/connect.cpp b/TAO/IIOP/lib/connect.cpp
index 41a5bd2a93d..613f25af9be 100644
--- a/TAO/IIOP/lib/connect.cpp
+++ b/TAO/IIOP/lib/connect.cpp
@@ -4,7 +4,7 @@
#include "roa.h"
#include "debug.h"
-ROA_Handler::ROA_Handler (ACE_Thread_Manager* t)
+TAO_OA_Connection_Handler::TAO_OA_Connection_Handler (ACE_Thread_Manager* t)
: SUPERCLASS (t)
{
// Grab the singleton...at some later point in time we can provide
@@ -14,7 +14,7 @@ ROA_Handler::ROA_Handler (ACE_Thread_Manager* t)
}
int
-ROA_Handler::open (void*)
+TAO_OA_Connection_Handler::open (void*)
{
ACE_INET_Addr addr;
@@ -29,31 +29,35 @@ ROA_Handler::open (void*)
}
int
-ROA_Handler::handle_close (ACE_HANDLE handle,
+TAO_OA_Connection_Handler::handle_close (ACE_HANDLE handle,
ACE_Reactor_Mask rm)
{
- ACE_DEBUG ((LM_DEBUG, " (%P|%t) ROA_Handler::handle_close (%d,%d)\n", handle, rm));
+ ACE_DEBUG ((LM_DEBUG, " (%P|%t) TAO_OA_Connection_Handler::handle_close (%d,%d)\n", handle, rm));
return SUPERCLASS::handle_close (handle, rm);
}
int
-ROA_Handler::svc (void)
+TAO_OA_Connection_Handler::svc (void)
{
+ // This method is called when an instance is "activated", i.e., turned
+ // into an active object. Presumably, activation spawns a thread with this
+ // method as the "worker function".
int result = 0;
- ACE_DEBUG ((LM_DEBUG, " (%P|%t) ROA_Handler::svc begin\n"));
-
- // @@ This is an important method, please add a comment here.
+ ACE_DEBUG ((LM_DEBUG, " (%P|%t) TAO_OA_Connection_Handler::svc begin\n"));
+ // Here we simply synthesize the "typical" event loop one might find
+ // in a reactive handler, except that this can simply block waiting for
+ // input.
while ((result = handle_input ()) >= 0)
continue;
- ACE_DEBUG ((LM_DEBUG, " (%P|%t) ROA_Handler::svc end\n"));
+ ACE_DEBUG ((LM_DEBUG, " (%P|%t) TAO_OA_Connection_Handler::svc end\n"));
return result;
}
int
-ROA_Handler::handle_input (ACE_HANDLE handle)
+TAO_OA_Connection_Handler::handle_input (ACE_HANDLE handle)
{
// CJCXXX The tasks of this method should change to something like
// the following:
@@ -99,7 +103,7 @@ ROA_Handler::handle_input (ACE_HANDLE handle)
if (env.exception () != 0)
{
- dexc (env, "ROA_Handler, handle incoming message");
+ dexc (env, "TAO_OA_Connection_Handler, handle incoming message");
env.clear ();
}
return ret;
@@ -111,7 +115,7 @@ ROA_Handler::handle_input (ACE_HANDLE handle)
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
// Direct
-template class ACE_Acceptor<ROA_Handler, ACE_SOCK_ACCEPTOR>;
+template class ACE_Acceptor<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>;
template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
// Indirect
template class ACE_Task<ACE_NULL_SYNCH>;// ACE_Svc_Handler
diff --git a/TAO/IIOP/lib/connmgr.cpp b/TAO/IIOP/lib/connmgr.cpp
deleted file mode 100644
index 829d0b3d738..00000000000
--- a/TAO/IIOP/lib/connmgr.cpp
+++ /dev/null
@@ -1,785 +0,0 @@
-// @(#)connmgr.cpp 1.4 95/09/29
-// Copyright 1994-1995 by Sun Microsystems Inc.
-// All Rights Reserved
-//
-// IIOP: Simple asymmetric TCP connection manager
-//
-// This has been multithreaded with a very simple strategy, optimizing
-// for "lightly threaded" clients rather than maximal sharing of
-// system resources (connections, time) in concurrent environments.
-// Two locks are used, one each for client and server sides.
-//
-// The expectation is: threads have a refcount on an endpoint only
-// while a call's active. Between calls, they release the endpoint
-// record. If need be, the file descriptor in the record may be set
-// to a negative number, and the descriptor closed (e.g. on
-// unrecoverable error).
-//
-// The tricky issues have been strongly avoided. Particularly, on any
-// given connection no multiplexing is done; that simplifies this code
-// substantially, as well as the protocol code that'd otherwise need
-// to dispatch IIOP replies to arbitrary client threads. This costs
-// most if several "long" (time-wise) calls are made concurrently.
-//
-// Similarly, condition variables aren't used to allow concurrent
-// access to connection tables during "long" operations: name service
-// lookups, connection establishment, or both. Initial connection
-// establishment, including use of hostname aliases, pays this cost.
-
-#include <assert.h>
-#if !defined (VXWORKS)
-#include <memory.h>
-#endif
-#include <string.h>
-
-#include "ace/OS.h"
-
-#if defined (unix)
-# include <netdb.h>
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <sys/time.h>
-# include <netinet/in.h>
-#elif defined (VXWORKS)
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <time.h>
-# include <netinet/in.h>
-#else // unix
-# include <winsock.h>
-#endif // unix
-
-#include "orb.h"
-#include "stub.h"
-
-#include "connmgr.h"
-#include "thread.h"
-#include "debug.h"
-
-// We tell the kernel to queue no more than LISTEN_LIMIT connection
-// requests ... traditionally, BSD implementations max out at 5, but
-// more recent implementations have no OS limit.
-
-#define LISTEN_LIMIT 5 // traditional maximum
-
-// Lists holding the connections managed in this module: one for
-// outgoing connections (client list), the other for incoming ones
-// (server list).
-//
-// NOTE: with multiple OAs, it'll be desirable to let each OA have its
-// own server endpoint list so OAs can manage requests (and their
-// threading) separately.
-
-// @@ Can we remove this stuff now?
-static client_endpoint *client_list;
-static server_endpoint *server_list;
-
-#ifdef _POSIX_THREADS
-//
-// If POSIX threads are available, set up locks covering access to
-// both client and server side connection lists. They're separate
-// to avoid deadlocking, e.g. self-deadlock when a process calls to
-// an object it implements.
-//
-static pthread_mutex_t client_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t server_lock = PTHREAD_MUTEX_INITIALIZER;
-
-// We need to cleanly indicate to select()ing server threads that a
-// a connection has been returned to their purview. The simplest way
-// is for them to wake up normally ... e.g. by data arriving. We use
-// writes on a private pipe: that's what signal_fd is for.
-
-static ACE_HANDLE signal_fd;
-
-// Conceptually, each TCP OA listens to a single "in" signal FD. But
-// we only support one of them for now.
-
-static ACE_HANDLE signal_in_fd;
-
-#endif /* _POSIX_THREADS */
-
-// Release ... must be reentrant in threaded systems.
-
-void
-client_endpoint::release (void)
-{
-#ifdef _POSIX_THREADS
- Critical region (&client_lock);
-#endif // _POSIX_THREADS
-
- assert (refcount == 1);
- refcount--;
-}
-
-// Gets or makes a connection to the indicated host@port, or reports
-// an exception explaining why it couldn't.
-
-client_endpoint *
-client_endpoint::lookup (
- char *host,
- unsigned short port,
- CORBA_Environment &env
-)
-{
- client_endpoint *list;
- hostent *hp = 0;
-
-#ifdef _POSIX_THREADS
- Critical region (&client_lock);
-#endif // _POSIX_THREADS
-
- //
- // see if it's already in the list. if we find it here, we've
- // saved a costly/remote name service lookup.
- //
- // THREADING NOTE: a policy decision is made here to use a different
- // connection when an existing one is in use. As with all policies,
- // there are cases where different decisions would be in some sense
- // more optimal. The rationale is primarily that simpler MT code is
- // preferable; blocking until the connection is idle again can easily
- // deadlock mutually recursive invocations, and performance tradeoffs
- // don't argue universally for multiplexing connections.
- //
- for (list = client_list; list != 0; list = list->next) {
- if (list->port == port) {
- if (list->fd == ACE_INVALID_HANDLE) {
- dmsg ("client, dead FD in endpoint table");
- continue;
- }
- if (strcmp (list->hostname, host) == 0) {
- if (list->refcount == 0) {
- list->refcount++;
- return list;
- } else {
- //
- // find/make a different connection, this one
- // is busy for the moment
- //
- continue;
- }
- }
-
- // else maybe one's an address, one's a name
- // or one's a FQDN, one's not fully qualified
- // ...
- }
- }
-
- //
- // See if we can find the host's address. This handles two styles
- // of hostname: domain names (including partially qualified names,
- // which rely on some implicit location in the DNS hierarchy), and
- // "dotted-decimal" notation (e.g. "192.9.200.1"). Both forms are
- // required by Internet standards (and hence IIOP).
- //
- // THREADING NOTE: gethostbyname is a "long" call, it'd often be worth
- // dropping the lock during this call. It'd complicate control flow
- // though, so until heavily threaded clients are common it's left
- // to work in this simple way.
- //
- // XXX note that some platforms, particularly older ones no longer
- // being actively maintained, violate Internet standards and don't
- // accept dotted-decimal hostnames.
- //
- if (hp == 0) {
-#if defined (DECLARED_H_ERRNO)
- while ((hp = ACE_OS::gethostbyname (host)) == 0) {
- switch (h_errno) {
- case TRY_AGAIN: // soft error
- // sleep (1);
- continue;
-
- case HOST_NOT_FOUND: // hard NAK (not-exist)
- dmsg1 ("gethostbyname '%s' --> No such host", host);
- env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO));
- return 0;
-
- case NO_RECOVERY: // hard error
- case NO_DATA: // maybe found an MX record?
- default: // nonstandard error code
- dmsg2 ("gethostbyname '%s' --> h_errno %d", host, h_errno);
- env.exception (new CORBA_COMM_FAILURE (COMPLETED_NO));
- return 0;
- }
- }
-#else
- // If gethostbyname returns 0, assume host doesn't exist
- if ((hp = ACE_OS::gethostbyname (host)) == 0) {
- dmsg1 ("gethostbyname '%s' --> No such host", host);
- env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO));
- return 0;
- }
-#endif
- //
- // Here we found the address associated with the hostname.
- //
- // NOTE: if we save addresses in the connection table, we might
- // rescan it on the grounds that maybe we got a hostname alias
- // (e.g. not the DNS CNAME). No functionality lost if we don't,
- // but in some cases we'd save a connection.
- //
- }
-
- //
- // Here we've decided to grow the set of connections to satisfy
- // this request. We get the record and then fill it out.
- //
- // NOTE: Should first shrink the list if it's very large! We could
- // track time of last use to support LRU purging of connection cache,
- // with potential removing of duplicates.
- //
- list = new client_endpoint;
-
- if ((list->fd = ACE_OS::socket (AF_INET, SOCK_STREAM, 0)) == ACE_INVALID_HANDLE) {
- dsockerr ("client socket");
- delete list;
-
- env.exception (new CORBA_UNKNOWN (COMPLETED_NO));
- return 0;
- }
-
- //
- // SECURITY NOTE: Some networks routinely configure bridges based on
- // source and destination port. So it may be important to bind this
- // socket to some preestablished port before connecting, since without
- // doing so the traffic may not be passed through a firewall or bridge.
- //
-
-
- //
- // Connect to the desired server address.
- //
- // THREADING NOTE: this is again a "long" call, during which it'll be
- // worth dropping the lock on the connection list some day when many
- // client threads contend on that lock.
- //
- sockaddr_in addr;
-
- ACE_OS::memset (&addr, 0, sizeof addr);
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = *(long *)hp->h_addr;
- addr.sin_port = htons (port);
-
- if (ACE_OS::connect (list->fd, (sockaddr *) &addr, sizeof addr) < 0) {
- dsockerr ("client connect");
- dmsg2 ("... connect failure was to '%s:%d'", host, port);
- delete list;
-
- env.exception (new CORBA_COMM_FAILURE (COMPLETED_NO));
- return 0;
- }
-
- list->hostname = ACE_OS::strdup (host);
- list->port = port;
- list->refcount = 1;
- list->next = client_list;
-
- client_list = list;
-
- return list;
-}
-
-
-#ifdef DEBUG
-
-void
-client_endpoint::dump (FILE *file)
-{
- client_endpoint *list;
-
-#ifdef _POSIX_THREADS
- //
- // NOTE that although this lock is held for a _very_ long time
- // (terminal/stderr I/O is much slower than network I/O and this
- // does "lots" of it) we don't have much of an option because we
- // need to present a single, consistent view of this table.
- //
- Critical region (&client_lock);
-#endif // _POSIX_THREADS
-
- ACE_OS::fprintf (file, "List of client-side connections:\n");
-
- for (list = client_list; list != 0; list = list->next) {
- ACE_OS::fprintf (file, " %s @ %d\tfd %d\trefcnt %d\n",
- list->hostname, list->port, list->fd,
- list->refcount);
- }
- ACE_OS::fprintf (file, "\n");
-}
-
-#endif
-
-
-
-//
-// Release ... must be reentrant in threaded systems.
-//
-// NOTE: this version actually does two things, which could be split
-// into two separate routines with some TBD effect on performance. It
-// decrements the use count of this connection; and it informs other
-// potential reading threads that it's OK to read incoming messages.
-//
-// Splitting these two apart could let the server issue Reply messages
-// in arbitrary orders, at the potential cost of putting extra context
-// switching into the critical path for request handling.
-//
-void
-server_endpoint::release ()
-{
-#ifdef _POSIX_THREADS
- Critical region (&server_lock);
-#endif // _POSIX_THREADS
-
- assert (refcount == 1);
- refcount--;
-
-#ifdef _POSIX_THREADS
- //
- // Tell whoever's in block_for_input() that they can look again
- // at this connection, reading messages off of it and replying
- // to them as appropriate.
- //
- (void) ACE_OS::write (signal_fd, "b", 1);
-#endif // _POSIX_THREADS
-}
-
-
-//
-// Initialize a server endpoint, at the specified port or, if that port
-// number is zero, then at any available port.
-//
-// XXX at some point this will include an interface name, to facilitate
-// its use on multihomed hosts such as firewalls.
-//
-server_endpoint *
-server_endpoint::initialize (
- unsigned short &port,
- // XXX char *ifname
- CORBA_Environment &env
-)
-{
-#ifdef _POSIX_THREADS
- Critical region (&server_lock);
-#endif // _POSIX_THREADS
-
- //
- // XXX at this time, we only support one port/listener per process.
- // This restriction should be lifted sometime.
- //
- if (server_list != 0) {
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
-
- //
- // Initial "connection" record.
- //
- server_endpoint *list;
-
- list = new server_endpoint;
- list->is_passive = CORBA_B_TRUE;
- list->port = port;
- list->next = 0;
- list->refcount = 0;
-
- //
- // Create the socket
- //
- if ((list->fd = ACE_OS::socket (AF_INET, SOCK_STREAM, 0)) == ACE_INVALID_HANDLE) {
- dsockerr ("server socket");
- delete list;
-
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
-
- //
- // Bind it to the requested port, if one was requested.
- //
- sockaddr_in addr;
-
- if (port != 0) {
-#ifdef SO_REUSEADDR
- //
- // In cases where servers abort and must be restarted, we
- // want to avoid TCP's mandatory 4 minute close-wait timeout.
- // So we set SO_REUSEADDR only on the "listening" socket,
- // which never actually gets a connection; it's safe to be
- // "reusing" the address since the OS never reuses TCP ports
- // which are in the BOUND or LISTEN states.
- //
- // If we can't do this, it's not an error -- this is just an
- // optimization applicable to some failure cases, we can live
- // without it in all cases. Applications might care; if so,
- // they should run on platforms supporting SO_REUSEADDR.
- //
- int flag = 1;
-
- if (ACE_OS::setsockopt (list->fd, SOL_SOCKET, SO_REUSEADDR,
- (char *) &flag, sizeof (flag)) < 0) {
- dsockerr ("server setsockopt SO_REUSEADDR");
- }
-#endif // SO_REUSEADDR
-
- ACE_OS::memset (&addr, 0, sizeof addr);
- addr.sin_family = AF_INET;
- addr.sin_port = htons (port);
-
- //
- // XXX someday, this is where we'll bind to specific interfaces
- // on multihomed hosts (e.g. firewalls) which do no routing.
- //
- addr.sin_addr.s_addr = htonl (INADDR_ANY);
-
- if (ACE_OS::bind (list->fd, (sockaddr *)&addr, sizeof addr) < 0) {
- dsockerr ("server bind");
- ACE_OS::closesocket (list->fd);
- delete list;
-
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
- }
-
- //
- // Make it a listening (passive) socket
- //
- if (ACE_OS::listen (list->fd, LISTEN_LIMIT) < 0) {
- dsockerr ("server listen");
- ACE_OS::closesocket (list->fd);
- delete list;
-
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
-
- //
- // If we bound to a system-assigned port, find out which port
- // address the system assigned us.
- //
- if (port == 0) {
- int size = sizeof (addr);
-
- if (ACE_OS::getsockname (list->fd, (sockaddr *) &addr, &size) < 0) {
- dsockerr ("server getsockname");
- ACE_OS::closesocket (list->fd);
- delete list;
-
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
- port = list->port = ntohs (addr.sin_port);
- }
-
-#ifdef _POSIX_THREADS
- //
- // We need a clean way to have other threads signal ones that
- // are select()ing that there's another connection they need to
- // pay attention to. So we set up a pipe for them to use.
- //
- ACE_HANDLE pipefd [2];
-
- if (ACE_OS::pipe (pipefd) != 0) {
- dperror ("pipe for connection manager");
- ACE_OS::closesocket (list->fd);
- delete list;
-
- env.exception (new CORBA_INITIALIZE (COMPLETED_NO));
- return 0;
- }
- signal_in_fd = pipefd [0];
- signal_fd = pipefd [1];
-#endif // _POSIX_THREADS
-
- server_list = list;
-
- return list;
-}
-
-
-//
-// Get a connection. Unless "eager" is set, the connection returned
-// will actually have data ready for input. Normally, unthreaded
-// environments can't be "eager", and threaded environments prefer to
-// use that model to achieve better performance. Threaded environments
-// can of course not be "eager".
-//
-// THREADING NOTE: It's undesirable to have more than one thread call this
-// at the same time; the semantics of two threads that select() on the same
-// file descriptor are undefined. Hence the static flag that's tested.
-//
-server_endpoint *
-server_endpoint::block_for_connection (
- CORBA_Boolean eager,
- timeval *timeout,
- CORBA_Environment &env
-)
-{
-#ifdef _POSIX_THREADS
- Critical region (&server_lock);
-#endif // _POSIX_THREADS
-
- //
- // Head of the list is a passive file descriptor. The rest is a list
- // of ones used for I/O to clients. Only call block_for_input() on
- // endpoints returned by initialize().
- //
- assert (is_passive);
-
- //
- // Scan the list of server-side connections and generate the fd_set
- // we'd use in a select() call (or eagerly return a file descriptor,
- // without selecting first). Make the call, examine the results;
- // maybe we return soon to the caller, maybe we don't.
- //
- // XXX if there are lots of connections here we should contemplate
- // shutting down several of them in order to gracefully reclaim the
- // OS resources associated with the connections.
- //
- for (;;) {
- fd_set read_fdset;
- server_endpoint *list, *previous;
- int max_fd = 0;
-
- FD_ZERO (&read_fdset);
- for (list = this, previous = 0;
- list;
- previous = list, list = list->next) {
-
- //
- // Delete records for connections that were closed and
- // which nobody is using.
- //
- if (list->fd == ACE_INVALID_HANDLE) {
- if (list->refcount != 0)
- continue;
-
- assert (previous != 0); // passive must exist!
-
- previous->next = list->next;
- delete list;
- list = previous;
- continue;
- }
-
- //
- // If nobody else is reading from this connection, we work with
- // it ... if the caller is "eager" we return it immediately
- // (even with no data). Else we prepare to select on it.
- //
- // Refcount is currently used to track if someone's reading,
- // though it'd be easy to further distinguish "someone reading"
- // from "someone needs". A "needed" connection without someone
- // currently reading could be assigned a thread to read it;
- // that would enable out-of-order processing (a lock would be
- // needed to ensure no interleaving of GIOP 1.1 fragments).
- //
- if (list->refcount == 0) {
- if (eager && !list->is_passive) {
- list->refcount++;
- return list;
- }
-
-#if defined(_WIN32)
-# define FDSET_CAST (SOCKET)
-#else
-# define FDSET_CAST
-#endif
- FD_SET (FDSET_CAST list->fd, &read_fdset);
- if (FDSET_CAST list->fd > max_fd)
- max_fd = FDSET_CAST list->fd;
- }
- }
-
- //
- // Select until something interesting happens.
- //
- // THREADING NOTE: We leave the critical section for the duration
- // of this select() since we'll normally be there a long time, and
- // other threads must grab server_lock while we block. But we must
- // reenter it later to compare the select() output with the set of
- // legal server side connections.
- //
- // Also, since the semantics of multiple threads calling select()
- // on the same file descriptor(s) is undefined, we prevent that.
- //
- // We add the pipe file descriptor to the list so that when other
- // threads release connections, we can learn about this.
- //
-#ifdef _POSIX_THREADS
- static int doing_select; // = 0
-
- if (doing_select) {
- dmsg ("concurrent block_for_input() calls");
- env.exception (new CORBA_IMP_LIMIT (COMPLETED_NO));
- return 0;
- } else
- doing_select = 1;
-
- region.leave ();
-
- FD_SET (signal_in_fd, &read_fdset);
- if (signal_in_fd > max_fd)
- max_fd = signal_in_fd;
-#endif // _POSIX_THREADS
-
- // This cheap hack needs to be changed later...of course,
- // we won't need it when everything becomes ACE-ified. ;-)
- int value;
- if (timeout)
- {
- ACE_Time_Value tv(*timeout);
- value = ACE_OS::select (max_fd + 1, &read_fdset,
- (fd_set*)NULL, (fd_set*)NULL, tv);
- }
- else
- value = ACE_OS::select (max_fd + 1, &read_fdset,
- (fd_set*)NULL, (fd_set*)NULL, 0);
-
-
-#ifdef _POSIX_THREADS
- region.enter ();
- doing_select = 0;
-#endif // _POSIX_THREADS
-
- if (value < 0) {
- dsockerr ("server select");
- env.exception (new CORBA_COMM_FAILURE (COMPLETED_NO));
- return 0;
- } else if (value == 0) {
- dmsg ("server select timed out");
-
- return 0;
- }
-
- //
- // Check out the set of FDs we found out about in select() above.
- // If accept() is needed, do so and rescan. Else return an entry
- // from the list.
- //
- // THREADING NOTE: we read any byte written by another thread
- // to wake us up. Rare to have more than one such byte!
- //
-#ifdef _POSIX_THREADS
- if (FD_ISSET (signal_in_fd, &read_fdset)) {
- char b;
- (void) ACE_OS::read (signal_in_fd, &b, 1);
- if (debug_level >= 5)
- dmsg ("block_for_input() woken up");
- }
-#endif // _POSIX_THREADS
-
- for (list = this; list; list = list->next) {
- if ( list->fd == ACE_INVALID_HANDLE
- || !FD_ISSET (list->fd, &read_fdset))
- continue;
-
- //
- // If we've got one with incoming data, return it.
- //
- if (!list->is_passive) {
- list->refcount++;
- return list;
- }
-
- //
- // Nyet ... incoming connection. Accept it.
- //
- sockaddr_in saddr;
- int saddr_siz = sizeof saddr;
- ACE_HANDLE new_fd;
-
- if ((new_fd
- = ACE_OS::accept (list->fd, (sockaddr *) &saddr, &saddr_siz))
- == ACE_INVALID_HANDLE) {
- dsockerr ("server accept");
- continue; // what else?
- }
-
- server_endpoint *new_clnt;
-
- new_clnt = new server_endpoint;
- new_clnt->fd = new_fd;
- new_clnt->port = saddr.sin_port;
- new_clnt->is_passive = CORBA_B_FALSE;
- new_clnt->refcount = 0;
-
- dmsg1 ("accepted new FD %d", fd);
-
- //
- // Splice it into list betwen here and next. Since most
- // systems can't piggyback data with the connection setup
- // packet, there's probably no data here yet. We can't
- // find out when it arrives without blocking or polling.
- //
- new_clnt->next = list->next;
- list->next = new_clnt;
- list = new_clnt;
-
- //
- // One ramification of an "eager" model: we treat the
- // connection as having data immediately on connection
- // establishment. Lacking transactional TCP this will not
- // often be the case ... but the basic "eager" model is
- // that we spend LWPs (threads) to improve latencies.
- //
- if (eager) {
- new_clnt->refcount++;
- return new_clnt;
- }
- }
- }
-}
-
-void
-server_endpoint::shutdown_connections (
- void (*close_conn) (ACE_HANDLE &, void *),
- void *info
-)
-{
- server_endpoint *list, *successor;
-
-#ifdef _POSIX_THREADS
- Critical region (&server_lock);
-#endif // _POSIX_THREADS
-
- for (list = this; list != 0; list = successor) {
- if (list->is_passive)
- (void) ACE_OS::closesocket (list->fd);
- else
- close_conn (list->fd, info);
-
- successor = list->next;
- delete list;
- }
-}
-
-
-#ifdef DEBUG
-
-void
-server_endpoint::dump (FILE *file)
-{
- server_endpoint *list;
-
-#ifdef _POSIX_THREADS
- //
- // NOTE the comment in client_endpoint::dump() re long lock times.
- //
- Critical region (&client_lock);
-#endif // _POSIX_THREADS
-
- ACE_OS::fprintf (file, "List of server-side connections:\n");
-
- for (list = server_list; list != 0; list = list->next) {
- ACE_OS::fprintf (file, " port %d%s\tfd %d\trefcnt %d\n",
- list->port, list->is_passive ? " (passive)" : "",
- list->fd, list->refcount);
- }
- ACE_OS::fprintf (file, "\n");
-}
-
-#endif
-
diff --git a/TAO/IIOP/lib/connmgr.h b/TAO/IIOP/lib/connmgr.h
deleted file mode 100644
index 2da2a885e55..00000000000
--- a/TAO/IIOP/lib/connmgr.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// connect.h
-//
-// = DESCRIPTION
-// Simple threaded asymmetric TCP connection manager.
-//
-// = AUTHOR
-// Copyright 1994-1995 by Sun Microsystems Inc.
-//
-// ============================================================================
-
-#if !defined (TAO_CONNMGR_H)
-#define TAO_CONNMGR_H
-
-#include "ace/OS.h"
-
-#if unix
-# include <sys/time.h>
-#elif defined (VXWORKS)
-# include <time.h>
-#else // __WIN32__
-# include <winsock.h>
-#endif
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-template <class T>
-class autorelease
- // = TITLE
- // Utility class that may not really belong here; it's currently used
- // only with connection endpoints though.
- //
- // THREADING NOTE: note that the pointer doesn't change, so two
- // threads could share an "autorelease<T>" value if they collaborated
- // about safe refcounting and destruction.
-{
-public:
- autorelease &operator= (T *ptr)
- {
- if (_state) _state->release ();
- _state = ptr;
- return *this;
- }
-
- operator int () { return _state ? 1 : 0; }
- T *operator -> () { return _state; }
-
- autorelease (void) { _state = 0; }
- ~autorelease (void)
- { if (_state) _state->release (); }
-
-private:
- T *_state;
-};
-
-struct client_endpoint
- // = TITLE
- // Client endpoints are acquired just by looking them up; they're
- // created if needed, and may be closed when they're not in use.
- //
- // NOTE: timeout on lookup/create would be a nice quality-of-service
- // knob to be able to tweak...
-{
- // @@ Can you please change <fd> to <handle>?
- ACE_HANDLE fd;
-
- // @@ Is this API still required now that we've got the client-side
- // connection manager?
- static client_endpoint *lookup (char *host,
- u_short port,
- CORBA_Environment &env);
- void release (void);
- // @@ Please add comments.
-
-#ifdef DEBUG
- static void dump (FILE *);
-#endif /* DEBUG */
-
-private:
- // @@ Please add comments.
- char *hostname;
- u_short port;
- u_int refcount;
- client_endpoint *next;
-
-#ifdef __GNUG__
- //
- // G++ (even 2.6.3) stupidly thinks instances can't be
- // created This de-warns.
- //
- friend class everyone_needs_a_friend;
-#endif
-};
-
-// @@ Is this code still used? If not, can we remove it?
-
-class server_endpoint
- // = TITLE
- // Server endpoints start out by waiting passively for input on a port.
- // New connections may be created. Old ones may be disconnected.
- //
- // NOTE: this version doesn't bind to specific host addresses on
- // multihomed hosts, so it's not yet suitable for use on firewalls.
- //
- // NOTE: this version also doesn't listen on more than one port at a time.
-{
-public:
- // @@ Please change <fd> to <handle>.
- ACE_HANDLE fd;
-
- static server_endpoint *initialize (u_short &port,
- CORBA_Environment &env);
-
- server_endpoint *block_for_connection (CORBA_Boolean eager,
- timeval *timeout,
- CORBA_Environment &env);
-
- // Add a flag saying some, all?
- void shutdown_connections (void (*close_conn)(ACE_HANDLE &fd,
- void *info),
- void *info);
-
- void release (void);
-
-#ifdef DEBUG
- static void dump (FILE *);
-#endif
-
-private:
- u_short port;
- CORBA_Boolean is_passive;
- u_int refcount;
- server_endpoint *next;
-
-#if defined (__GNUG__)
- //
- // G++ (even 2.6.3) stupidly thinks instances can't be
- // created. This de-warns.
- //
- friend class everyone_needs_a_friend;
-#endif
-};
-
-#endif /* TAO_CONNMGR_H */
diff --git a/TAO/IIOP/lib/debug.cpp b/TAO/IIOP/lib/debug.cpp
index 443b30f15dc..3b5c645084c 100644
--- a/TAO/IIOP/lib/debug.cpp
+++ b/TAO/IIOP/lib/debug.cpp
@@ -16,28 +16,29 @@
#include <string.h>
#include <orb.h>
-#include "thread.h"
-#include "debug.h"
+#include "debug.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <stdarg.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+#if 0
#if unix
-#include <sys/types.h>
+#include <sys/types.h>
#elif defined (_WIN32)
# include <windows.h>
#endif
+#endif
#ifndef _POSIX_THREADS // _POSIX_THREAD_SAFE_FUNCTIONS implied
#define flockfile (f)
#define funlockfile (f)
#endif // _POSIX_THREADS
-u_int debug_level = 0;
-char *debug_filter = "l";
+u_int TAO_debug_level = 0;
+char *TAO_debug_filter = "l";
static FILE *debug_stream = stderr;
// The rest of this file is not needed without -DDEBUG, and unless the
diff --git a/TAO/IIOP/lib/debug.h b/TAO/IIOP/lib/debug.h
index 9a2d906b045..57459eb9af2 100644
--- a/TAO/IIOP/lib/debug.h
+++ b/TAO/IIOP/lib/debug.h
@@ -33,10 +33,10 @@ extern "C" char *strerror (int);
// "tao_debug_level", etc. to protect the namespace.
// 0 to ??; higher == more
-extern u_int debug_level;
+extern u_int TAO_debug_level;
// set by getopt
-extern char *debug_filter;
+extern char *TAO_debug_filter;
// These are just simple 0, 1, and 2 argument messages that will
// appear when debugging's enabled, regardless of category. They also
@@ -48,21 +48,21 @@ extern char *debug_filter;
#include <string.h>
// 1, 2, 3 argument messages -- generic
-#define dmsg(s) { if (debug_level) dmsg_v (s); }
-#define dmsg1(s,a1) { if (debug_level) dmsg_v (s, a1); }
-#define dmsg2(s,a1,a2) { if (debug_level) dmsg_v (s, a1, a2); }
+#define dmsg(s) { if (TAO_debug_level) dmsg_v (s); }
+#define dmsg1(s,a1) { if (TAO_debug_level) dmsg_v (s, a1); }
+#define dmsg2(s,a1,a2) { if (TAO_debug_level) dmsg_v (s, a1, a2); }
// dump CORBA_Exception, if any, with id tag
-#define dexc(env,s) { if (debug_level && env.exception ()) \
+#define dexc(env,s) { if (TAO_debug_level && env.exception ()) \
_dmsg_x (env, s); }
// dump POSIX error indication, if any, with ID tag
-#define dperror(str) { if (debug_level) dmsg_v ("%s: %s", \
+#define dperror(str) { if (TAO_debug_level) dmsg_v ("%s: %s", \
str, strerror (errno)); }
// dump socket error indication, if any, with ID tag
#if defined (_WINSOCKAPI_)
-#define dsockerr(s) { if (debug_level) dmsg_v ("%s: winsock error %d", \
+#define dsockerr(s) { if (TAO_debug_level) dmsg_v ("%s: winsock error %d", \
s, WSAGetLastError()); }
#else
#define dsockerr(s) dperror(s)
@@ -85,15 +85,15 @@ extern char *debug_filter;
#if defined (DEBUG)
// This is like an fprintf statement except the filter is a set of
-// characters (string). If debug_level is nonzero and any characters
-// in that string are in the "debug_filter" string, the message is
+// characters (string). If TAO_debug_level is nonzero and any characters
+// in that string are in the "TAO_debug_filter" string, the message is
// then printed. Assign thosee characters as needed.
extern void _EXPFUNC dmsg_filter (const char *_FAR filter,
const char *_FAR fmt, ...);
-// Filter according to debug_level instead of category. (For speed,
-// test against debug_level directly.)
+// Filter according to TAO_debug_level instead of category. (For speed,
+// test against TAO_debug_level directly.)
extern void _EXPFUNC dmsg_filter (u_int level,
const char *_FAR fmt, ...);
diff --git a/TAO/IIOP/lib/factories.cpp b/TAO/IIOP/lib/factories.cpp
index 70702b486cf..98795912434 100644
--- a/TAO/IIOP/lib/factories.cpp
+++ b/TAO/IIOP/lib/factories.cpp
@@ -91,15 +91,32 @@ TAO_Client_Factory::TAO_Client_Factory (void)
);
}
+TAO_Client_Factory::~TAO_Client_Factory (void)
+{}
+
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Thread_Strategy<ROA_Handler>;
-template class ACE_Concurrency_Strategy<ROA_Handler>;
-template class ACE_Reactive_Strategy<ROA_Handler>;
-template class ACE_Creation_Strategy<ROA_Handler>;
-template class ACE_Scheduling_Strategy<ROA_Handler>;
-template class ACE_Accept_Strategy<ROA_Handler, ACE_SOCK_ACCEPTOR>;
-#define CLIENT_HANDLER Svc_Handler
-template class ACE_Cached_Connect_Strategy<CLIENT_HANDLER, ACE_SOCK_STREAM, ACE_SYNCH_RW_MUTEX>;
-template class ACE_NOOP_Creation_Strategy<CLIENT_HANDLER>;
-template class ACE_Strategy_Connector<CLIENT_HANDLER, ACE_SOCK_STREAM>;
+template class ACE_Thread_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Concurrency_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Reactive_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Creation_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Scheduling_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>;
+
+template class ACE_Creation_Strategy<TAO_Client_Connection_Handler>;
+template class ACE_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
+template class ACE_Concurrency_Strategy<TAO_Client_Connection_Handler>;
+template class ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR, ACE_RW_Thread_Mutex>;
+template class ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>;
+template class ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
+template class ACE_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
+#define TAO_HASH_ADDR ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>
+template class TAO_HASH_ADDR;
+template class ACE_Hash_Map_Manager<TAO_HASH_ADDR, TAO_Client_Connection_Handler*, ACE_RW_Thread_Mutex>;
+template class ACE_Hash_Map_Entry<TAO_HASH_ADDR, TAO_Client_Connection_Handler*>;
+#define TAO_SVC_TUPLE ACE_Svc_Tuple<TAO_Client_Connection_Handler>
+template class TAO_SVC_TUPLE;
+template class ACE_Map_Manager<int, TAO_SVC_TUPLE*, ACE_RW_Thread_Mutex>;
+template class ACE_Map_Iterator<int, TAO_SVC_TUPLE*, ACE_RW_Thread_Mutex>;
+template class ACE_Map_Entry<int, TAO_SVC_TUPLE*>;
+
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/TAO/IIOP/lib/factories.h b/TAO/IIOP/lib/factories.h
index 7b0c685bc1a..2ef9af7d577 100644
--- a/TAO/IIOP/lib/factories.h
+++ b/TAO/IIOP/lib/factories.h
@@ -57,9 +57,10 @@ class TAO_Client_Factory
// strategies used on the client side.
{
public:
- typedef ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR> CONNECTOR;
- typedef ACE_NOOP_Creation_Strategy<Svc_Handler> NULL_CREATION_STRATEGY;
- typedef ACE_Cached_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR, ACE_RW_Thread_Mutex> CACHED_CONNECT_STRATEGY;
+ typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR> CONNECTOR;
+ typedef ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler> NULL_CREATION_STRATEGY;
+ typedef ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler,
+ ACE_SOCK_CONNECTOR, ACE_RW_Thread_Mutex> CACHED_CONNECT_STRATEGY;
#if defined(TAO_HAS_CLIENT_CONCURRENCY)
CONCURRENCY_STRATEGY *concurrency_strategy (void);
@@ -69,6 +70,7 @@ public:
// Return a pointer to a connector using appropriate strategies.
TAO_Client_Factory (void);
+ ~TAO_Client_Factory (void);
private:
#if defined(TAO_HAS_CLIENT_CONCURRENCY)
@@ -104,9 +106,10 @@ public:
private:
// = COMMON
- // @@ Please add comments.
ACE_Thread_Strategy<TAO_OA_Connection_Handler> threaded_strategy_;
+ // The threaded strategy used for passively establishing connections.
ACE_Reactive_Strategy<TAO_OA_Connection_Handler> reactive_strategy_;
+ // A strategy for passively establishing connections which utilizes the Reactor.
// = SERVER
CONCURRENCY_STRATEGY *concurrency_strategy_;
diff --git a/TAO/IIOP/lib/factories.i b/TAO/IIOP/lib/factories.i
index 7a6b238aca0..f814e3b6f17 100644
--- a/TAO/IIOP/lib/factories.i
+++ b/TAO/IIOP/lib/factories.i
@@ -54,3 +54,9 @@ TAO_Server_Factory::object_lookup_strategy (TAO_Object_Table *ot)
{
this->objtable_ = ot; // we assume ownership
}
+
+ACE_INLINE TAO_Client_Factory::CONNECTOR*
+TAO_Client_Factory::connector(void)
+{
+ return &connector_;
+}
diff --git a/TAO/IIOP/lib/giop.cpp b/TAO/IIOP/lib/giop.cpp
index 4c1e5f957ae..52402f7a407 100644
--- a/TAO/IIOP/lib/giop.cpp
+++ b/TAO/IIOP/lib/giop.cpp
@@ -40,31 +40,23 @@
// error is detected when marshaling or unmarshaling, it should be
// reported.
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ace/Log_Msg.h"
#include "ace/SOCK_Stream.h"
-// @@ Are the following #include's necessary if we use ACE?
+#include "orbobj.h"
+#include "factories.h"
-#if (unix) || defined (VXWORKS)
-# include <sys/types.h>
-# include <sys/socket.h>
+#include <orb.h>
-#else
-# include <winsock.h>
-
-#endif
-
-#include <orb.h>
-
-#include "cdr.h"
-#include "debug.h"
-#include "thread.h"
-#include "giop.h"
+#include "cdr.h"
+#include "debug.h"
+#include "giop.h"
// defined by GIOP 1.0 protocol
#define TAO_GIOP_HEADER_LEN 12
@@ -97,7 +89,6 @@ start_message (GIOP::MsgType type,
return CORBA_B_TRUE;
}
-#ifdef DEBUG
static const char digits [] = "0123456789ABCD";
static const char *names [] =
{
@@ -115,24 +106,19 @@ dump_msg (const char *label,
const u_char *ptr,
size_t len)
{
- if (debug_level >= 2)
+ if (TAO_debug_level >= 2)
{
- dmsg_v ("%s GIOP v%c.%c msg, %d data bytes, %s endian, %s\n",
- label, digits [ptr [4]], digits [ptr [5]],
- len - TAO_GIOP_HEADER_LEN,
- (ptr [6] == MY_BYTE_SEX) ? "my" : "other",
- (ptr [7] <= GIOP::MessageError)
- ? names [ptr [7]] : "UNKNOWN TYPE");
-
- if (debug_level >= 4)
- dmsg_opaque_full("data bytes", ptr, len);
+ ACE_DEBUG ((LM_DEBUG, "%s GIOP v%c.%c msg, %d data bytes, %s endian, %s\n",
+ label, digits[ptr[4]], digits[ptr[5]],
+ len - TAO_GIOP_HEADER_LEN,
+ (ptr[6] == MY_BYTE_SEX) ? "my" : "other",
+ (ptr[7] <= GIOP::MessageError) ? names [ptr[7]] : "UNKNOWN TYPE"));
+
+ if (TAO_debug_level >= 4)
+ ACE_HEX_DUMP ((LM_DEBUG, (const char*)ptr, len, "(%P|%t) data bytes"));
}
}
-#else // !DEBUG
-#define dump_msg(label,ptr,len)
-#endif // !DEBUG
-
CORBA_Boolean
GIOP::send_message (CDR &stream,
ACE_SOCK_Stream &peer)
@@ -176,8 +162,8 @@ GIOP::send_message (CDR &stream,
{
if (buflen > stream.length)
{
- dmsg2 ("?? writebuf, buflen %u > length %u\n",
- buflen, stream.length);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) ?? writebuf, buflen %u > length %u\n",
+ buflen, stream.length));
return CORBA_B_FALSE;
}
@@ -202,16 +188,15 @@ GIOP::send_message (CDR &stream,
if (writelen == -1)
{
- dsockerr ("OutgoingMessage::writebuf ()");
- dmsg1 ("closing conn %d after fault", connection);
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) OutgoingMessage::writebuf() $p"));
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) closing conn %d after fault", connection));
ACE_OS::closesocket (connection);
connection = ACE_INVALID_HANDLE;
return CORBA_B_FALSE;
}
else if (writelen == 0)
{
- dmsg1 ("OutgoingMessage::writebuf () ... EOF, closing conn %d",
- connection);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) OutgoingMessage::writebuf () ... EOF, closing conn %d", connection));
ACE_OS::closesocket (connection);
connection = ACE_INVALID_HANDLE;
return CORBA_B_FALSE;
@@ -280,7 +265,7 @@ GIOP::close_connection (ACE_HANDLE &handle,
(void) ACE::send (handle, close_message, TAO_GIOP_HEADER_LEN);
(void) ACE_OS::shutdown (handle, 2);
(void) ACE_OS::closesocket (handle);
- dmsg1 ("shut down socket %d", handle);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) shut down socket %d", handle));
handle = ACE_INVALID_HANDLE;
}
@@ -308,7 +293,7 @@ send_error (ACE_HANDLE &handle)
(void) ACE::send (handle, error_message, TAO_GIOP_HEADER_LEN);
(void) ACE_OS::shutdown (handle, 2);
(void) ACE_OS::closesocket (handle);
- dmsg1 ("aborted socket %d", handle);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) aborted socket %d", handle));
handle = ACE_INVALID_HANDLE;
}
@@ -415,8 +400,8 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
{
if (len == 0)
{ // EOF
- dmsg1 ("Header EOF ... peer probably aborted connection %d",
- connection);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Header EOF ... peer probably aborted connection %d",
+ connection));
return EndOfFile;
// XXX should probably find some way to report this without
// an exception, since for most servers it's not an error.
@@ -424,9 +409,9 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
//
}
else if (len < 0) // error
- dsockerr ("GIOP::read_message header");
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) GIOP::read_message header socket error %p"));
else // short read ...
- dmsg ("read message header failed (short)");
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) read message header failed (short)"));
env.exception (new CORBA_COMM_FAILURE (COMPLETED_MAYBE));
return MessageError;
@@ -444,7 +429,7 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
&& msg.buffer [3] == 'P'))
{
env.exception (new CORBA_MARSHAL (COMPLETED_MAYBE)); // header
- dmsg ("bad header, magic word");
+ ACE_DEBUG((LM_DEBUG, "bad header, magic word"));
return MessageError;
}
@@ -454,7 +439,7 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
if (!(msg.buffer [4] == MY_MAJOR && msg.buffer [5] <= MY_MINOR))
{
env.exception (new CORBA_MARSHAL (COMPLETED_MAYBE)); // header
- dmsg ("bad header, version");
+ ACE_DEBUG((LM_DEBUG, "bad header, version"));
return MessageError;
}
@@ -491,15 +476,15 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
if (len != (int) message_size)
{
if (len == 0)
- dmsg1 ("read message body, EOF on handle %d", connection);
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) read message body, EOF on handle %d", connection));
else if (len < 0)
- dperror ("GIOP::read_message () body");
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) GIOP::read_message () body %p"));
else
- dmsg2 ("short read, only %d of %d bytes", len, message_size);
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) short read, only %d of %d bytes", len, message_size));
// clean up, and ...
env.exception (new CORBA_COMM_FAILURE (COMPLETED_MAYBE)); // body
- dmsg ("couldn't read rest of message");
+ ACE_DEBUG ((LM_DEBUG, "couldn't read rest of message"));
return MessageError;
}
@@ -526,7 +511,7 @@ GIOP::read_message (ACE_SOCK_Stream &connection,
GIOP::Invocation::Invocation (IIOP_Object *data,
const char *operation,
CORBA_Boolean is_roundtrip)
- : _data (data),
+ : data_ (data),
opname (operation),
do_rsvp (is_roundtrip),
stream (&buffer [0], sizeof buffer)
@@ -547,7 +532,7 @@ GIOP::Invocation::Invocation (IIOP_Object *data,
GIOP::Invocation::~Invocation (void)
{
- handle_.in_use (CORBA_B_FALSE);
+ handler_->in_use (CORBA_B_FALSE);
}
// Octet codes for the parameters of the "Opaque" (sequence of octet)
@@ -659,8 +644,7 @@ GIOP::Invocation::start (CORBA_Environment &env)
// is not affected, the call will just be forwarded later than it
// might be in a more complex implementation.
- assert (endpoint == 0);
- assert (_data != 0);
+ assert (data_ != 0);
ACE_GUARD (ACE_Thread_Mutex, guard, lock_);
@@ -668,7 +652,7 @@ GIOP::Invocation::start (CORBA_Environment &env)
// Get a CORBA_Object_ptr from _data using QueryInterface ()
CORBA_Object_ptr obj = 0;
- (void) _data->QueryInterface (IID_CORBA_Object, (void **)&obj);
+ (void) data_->QueryInterface (IID_CORBA_Object, (void **)&obj);
// Get a pointer to the orb from the object
CORBA_ORB_ptr orb = obj->orb ();
@@ -800,7 +784,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
{
// Send Request, return on error or if we're done
- if (!GIOP::send_message (stream, endpoint->fd))
+ if (!GIOP::send_message (stream, handler_->peer()))
{
// send_message () closed the connection; we just release it here.
//
@@ -816,7 +800,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
// point in the code however! Some minor restructuring needs to
// happen.
//
- endpoint = 0;
+ handler_ = 0;
env.exception (new CORBA_COMM_FAILURE (COMPLETED_MAYBE));
return SYSTEM_EXCEPTION;
}
@@ -859,7 +843,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
// (explicitly coded) handlers called. We assume a POSIX.1c/C/C++
// environment.
//
- switch (GIOP::read_message (endpoint->fd, stream, env))
+ switch (GIOP::read_message (handler_->peer(), stream, env))
{
case Reply:
// handle reply ... must be right one etc
@@ -878,12 +862,12 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
{
ACE_GUARD_RETURN (ACE_Thread_Mutex, guard, lock_, SYSTEM_EXCEPTION);
- delete _data->fwd_profile;
- _data->fwd_profile = 0;
+ delete data_->fwd_profile;
+ data_->fwd_profile = 0;
- (void) ACE_OS::closesocket (endpoint->fd);
- endpoint->fd = ACE_INVALID_HANDLE;
- endpoint = 0;
+ handler_->peer().close();
+ handler_->in_use(CORBA_B_FALSE);
+ handler_ = 0;
return LOCATION_FORWARD;
}
@@ -896,7 +880,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
// be indicative of client bugs (lost track of input stream) or
// server bugs; maybe the request was acted on, maybe not, we
// can't tell.
- dmsg ("illegal message in response to my Request!");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) illegal message in response to my Request!"));
env.exception (new CORBA_COMM_FAILURE (COMPLETED_MAYBE));
// FALLTHROUGH ...
@@ -904,7 +888,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
// Couldn't read it for some reason ... exception's set already,
// so just tell the other end about the trouble (closing the
// connection) and return.
- send_error (endpoint->fd);
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
@@ -939,7 +923,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
if (CDR::decoder (&TC_ServiceContextList, &reply_ctx, 0, &stream, env)
!= CORBA_TypeCode::TRAVERSE_CONTINUE)
{
- send_error (endpoint->fd);
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
delete reply_ctx.buffer;
@@ -949,9 +933,9 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
|| !stream.get_ulong (reply_status)
|| reply_status > LOCATION_FORWARD)
{
- send_error (endpoint->fd);
+ send_error (handler_->peer());
env.exception (new CORBA_COMM_FAILURE (COMPLETED_MAYBE));
- dmsg ("bad Response header");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) bad Response header"));
return SYSTEM_EXCEPTION;
}
@@ -992,7 +976,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
if (stream.get_ulong (len) != CORBA_B_TRUE
|| len > stream.remaining)
{
- send_error (endpoint->fd);
+ send_error (handler_->peer());
env.exception (new CORBA_MARSHAL (COMPLETED_YES));
return SYSTEM_EXCEPTION;
}
@@ -1026,7 +1010,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
if (env.exception () != 0)
{
dexc (env, "invoke (), get exception ID");
- send_error (endpoint->fd);
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
@@ -1039,7 +1023,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
if (env.exception () != 0)
{
dexc (env, "invoke (), get exception size");
- send_error (endpoint->fd);
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
@@ -1054,11 +1038,10 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
!= CORBA_TypeCode::TRAVERSE_CONTINUE)
{
delete exception;
- dmsg2 ("invoke, unmarshal %s exception %s",
- (reply_status == USER_EXCEPTION)
- ? "user" : "system",
- exception_id);
- send_error (endpoint->fd);
+ ACE_DEBUG((LM_ERROR, "(%P|%t) invoke, unmarshal %s exception %s",
+ (reply_status == USER_EXCEPTION) ? "user" : "system",
+ exception_id));
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
env.exception (exception);
@@ -1100,7 +1083,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
(void **)&obj2) != NOERROR)
{
dexc (env, "invoke, location forward");
- send_error (endpoint->fd);
+ send_error (handler_->peer());
return SYSTEM_EXCEPTION;
}
CORBA_release (obj);
@@ -1117,8 +1100,8 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
ACE_GUARD_RETURN (ACE_Thread_Mutex, guard, lock_, SYSTEM_EXCEPTION);
- delete _data->fwd_profile;
- _data->fwd_profile = new IIOP::ProfileBody (obj2->profile);
+ delete data_->fwd_profile;
+ data_->fwd_profile = new IIOP::ProfileBody (obj2->profile);
obj2->Release ();
@@ -1127,7 +1110,7 @@ GIOP::Invocation::invoke (CORBA_ExceptionList &exceptions,
//
// Make sure a new connection is used next time.
//
- endpoint = 0;
+ handler_ = 0; // not sure this is correct!
}
break;
}
@@ -1180,7 +1163,7 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
case LocateReply:
case CloseConnection:
default: // Unknown message
- dmsg ("Illegal message received by server");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) Illegal message received by server"));
env.exception (new CORBA_COMM_FAILURE (COMPLETED_NO));
// FALLTHROUGH
@@ -1203,7 +1186,7 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
case Request:
{
RequestHeader req;
- CORBA _Boolean hdr_status;
+ CORBA_Boolean hdr_status;
// Tear out the service context ... we currently ignore it,
// but it should probably be passed to each ORB service as
@@ -1246,20 +1229,20 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
#ifdef DEBUG
if (debug_level >= 3)
{
- dmsg_v ("%sRequest ID %#lx from FD %d",
- req.response_expected ? "" : "Oneway ",
- req.request_id, peer.get_handle ());
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) %sRequest ID %#lx from FD %d",
+ req.response_expected ? "" : "Oneway ",
+ req.request_id, peer.get_handle ()));
if (debug_level >= 4)
{
- dmsg_opaque ("object key", req.object_key.buffer,
- req.object_key.length);
- dmsg_v (" opname '%s'", req.operation);
+ ACE_HEX_DUMP((LM_DEBUG, req.object_key.buffer,
+ req.object_key.length, "(%P|%t) object key"));
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) opname '%s'", req.operation);
if (req.requesting_principal)
- dmsg_opaque ("client principal",
- req.requesting_principal->id.buffer,
- req.requesting_principal->id.length);
+ ACE_HEX_DUMP((LM_DEBUG, req.requesting_principal->id.buffer,
+ req.requesting_principal->id.length,
+ "(%P|%t) client principal"));
else
- dmsg (" client principal (EMPTY)");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) client principal (EMPTY)"));
}
// NOTE: describe any service context, and how many bytes
@@ -1304,7 +1287,7 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
}
else if (status == OBJECT_FORWARD)
{
- dmsg ("forwarding Request message");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) forwarding Request message"));
response.put_ulong (LOCATION_FORWARD);
CDR::encoder (_tc_CORBA_Object,
&fwd_ref,
@@ -1392,7 +1375,7 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
if (check_forward == 0)
{
response.put_ulong (OBJECT_HERE);
- dmsg ("LocateRequest response: object is (always) here!");
+ ACE_DEBUG((LM_DEBUG, "(%P|%t) LocateRequest response: object is (always) here!"));
}
else
{
@@ -1403,14 +1386,14 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
if (status == OBJECT_FORWARD)
{
- dmsg ("LocateRequest response: forward requests");
+ ACE_DEBUG((LM_DEBUG, "LocateRequest response: forward requests"));
CDR::encoder (_tc_CORBA_Object, &fwd_ref, 0,
&response, env);
}
else if (status == OBJECT_HERE)
- dmsg ("LocateRequest response: object is here!");
+ ACE_DEBUG((LM_DEBUG, "LocateRequest response: object is here!"));
else
- dmsg ("LocateRequest response: no such object");
+ ACE_DEBUG((LM_DEBUG, "LocateRequest response: no such object"));
}
(void) send_message (response, peer);
}
@@ -1442,7 +1425,6 @@ GIOP::incoming_message (ACE_SOCK_Stream &peer,
}
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class autorelease<client_endpoint>;
template class CORBA_SEQUENCE<GIOP::ServiceContext>;
template class CORBA_SEQUENCE<CORBA_Octet>;
template class CORBA_SEQUENCE<CORBA_TypeCode*>;
diff --git a/TAO/IIOP/lib/giop.h b/TAO/IIOP/lib/giop.h
index bebad552679..87b436ed12a 100644
--- a/TAO/IIOP/lib/giop.h
+++ b/TAO/IIOP/lib/giop.h
@@ -29,8 +29,8 @@
# include <corba/stub.h>
# endif /* __IIOP_BUILD */
-# include "connmgr.h"
# include "iiopobj.h" // XXX -- not generic!
+# include "factories.h"
// XXX this same typedef is used in other places, e.g. iiopobj.hh
typedef CORBA_SEQUENCE <CORBA_Octet> opaque;
@@ -175,38 +175,36 @@ public:
// = Request, Reply headers
- // @@ It would be very useful to add comments to the fields in each
- // of these structs and enums.
struct RequestHeader
{
- ServiceContextList service_info;
- CORBA_ULong request_id;
- CORBA_Boolean response_expected;
- opaque object_key;
- CORBA_String operation;
- CORBA_Principal_ptr requesting_principal;
+ ServiceContextList service_info; // @@ More info needed
+ CORBA_ULong request_id; // Unique identifier for a request
+ CORBA_Boolean response_expected; // true if this request requires a response
+ opaque object_key; // @@ the object key of the destination object (is this right?)
+ CORBA_String operation; // Name of the operation being performed
+ CORBA_Principal_ptr requesting_principal; // Identifies the requester
};
enum ReplyStatusType
{
- NO_EXCEPTION,
- USER_EXCEPTION,
- SYSTEM_EXCEPTION,
- LOCATION_FORWARD
+ NO_EXCEPTION, // Request completed successfully
+ USER_EXCEPTION, // Request terminated with user exception
+ SYSTEM_EXCEPTION, // Request terminated with system exception
+ LOCATION_FORWARD // @@ More info
};
struct ReplyHeader
{
- ServiceContextList service_info;
- CORBA_ULong request_id;
- ReplyStatusType reply_status;
+ ServiceContextList service_info; // @@ More info
+ CORBA_ULong request_id; // Unique identifier of the request for which this is a reply
+ ReplyStatusType reply_status; // Status of the reply (see above enum)
};
// = Cancellation -- applies both to Requests and LocateRequests.
struct CancelRequestHeader
{
- CORBA_ULong request_id;
+ CORBA_ULong request_id; // Unique identifier of the request being cancelled
};
// = Location service support
@@ -267,7 +265,7 @@ public:
private:
// @@ Please add comments.
- IIOP_Object *_data;
+ IIOP_Object *data_;
const char *opname;
diff --git a/TAO/IIOP/lib/iiopobj.h b/TAO/IIOP/lib/iiopobj.h
index ba3ad39a175..75483f0c774 100644
--- a/TAO/IIOP/lib/iiopobj.h
+++ b/TAO/IIOP/lib/iiopobj.h
@@ -89,7 +89,7 @@ class ACE_Svc_Export IIOP_Object : public STUB_Object
{
public:
void do_call (CORBA_Environment &env,
- const calldata *info,
+ const TAO_Call_Data *info,
...);
// Stub-based invocation.
@@ -125,7 +125,7 @@ public:
IIOP_Object (char *repository_id);
IIOP_Object (char *repository_id,
- IIOP::ProfileBody profile);
+ IIOP::ProfileBody& profile);
// = COM stuff
ULONG __stdcall AddRef (void);
diff --git a/TAO/IIOP/lib/iiopobj.i b/TAO/IIOP/lib/iiopobj.i
index 24a4eca82e4..14f3278f4bc 100644
--- a/TAO/IIOP/lib/iiopobj.i
+++ b/TAO/IIOP/lib/iiopobj.i
@@ -31,3 +31,11 @@ IIOP_Object::IIOP_Object (char *repository_id)
_refcount (1)
{}
+ACE_INLINE
+IIOP_Object::IIOP_Object (char *repository_id, IIOP::ProfileBody& a_profile)
+ : fwd_profile (0),
+ base (this),
+ STUB_Object (repository_id),
+ _refcount (1),
+ profile(a_profile)
+{}
diff --git a/TAO/IIOP/lib/iioporb.cpp b/TAO/IIOP/lib/iioporb.cpp
index bf235b96594..d54d30da4b0 100644
--- a/TAO/IIOP/lib/iioporb.cpp
+++ b/TAO/IIOP/lib/iioporb.cpp
@@ -61,7 +61,7 @@ IIOP_ORB::object_to_string (CORBA_Object_ptr obj,
// Application writer controls what kind of objref strings they get,
// maybe along with other things, by how they initialize the ORB.
- if (use_omg_ior_format)
+ if (use_omg_ior_format_)
{
// By default, orbs use IOR strings; these are ugly (and error
// prone) but specified by CORBA.
diff --git a/TAO/IIOP/lib/iioporb.h b/TAO/IIOP/lib/iioporb.h
index 697261052bf..23bd35d08d9 100644
--- a/TAO/IIOP/lib/iioporb.h
+++ b/TAO/IIOP/lib/iioporb.h
@@ -37,7 +37,7 @@ class ACE_Svc_Export IIOP_ORB : public CORBA_ORB
public:
IIOP_ORB(void);
- ~IIOP_ORB (void) {}
+ ~IIOP_ORB (void);
CORBA_Object_ptr string_to_object (CORBA_String str,
CORBA_Environment &env);
@@ -62,6 +62,8 @@ private:
IIOP_ORB &operator = (const IIOP_ORB &);
};
+typedef IIOP_ORB* IIOP_ORB_ptr;
+
// Create a type for the singleton.
typedef ACE_Singleton<IIOP_ORB, ACE_Thread_Mutex> TAO_ORB;
diff --git a/TAO/IIOP/lib/iioporb.i b/TAO/IIOP/lib/iioporb.i
index 1fd03209faf..16bed67867e 100644
--- a/TAO/IIOP/lib/iioporb.i
+++ b/TAO/IIOP/lib/iioporb.i
@@ -1,3 +1,15 @@
+// $Id$
+
+ACE_INLINE
+IIOP_ORB::IIOP_ORB(void)
+ : use_omg_ior_format_(CORBA_B_FALSE)
+{}
+
+ACE_INLINE
+IIOP_ORB::~IIOP_ORB(void)
+{}
+
+
ACE_INLINE void
IIOP_ORB::use_omg_ior_format (CORBA_Boolean ior)
{
diff --git a/TAO/IIOP/lib/invoke.cpp b/TAO/IIOP/lib/invoke.cpp
index d3854f9a842..b803f491f25 100644
--- a/TAO/IIOP/lib/invoke.cpp
+++ b/TAO/IIOP/lib/invoke.cpp
@@ -28,16 +28,15 @@
// generate better code, which in some cases may be very hard to
// unwind.
-#include <assert.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <orb.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <orb.h>
-#include "cdr.h"
-#include "debug.h"
-#include "giop.h"
-#include "connmgr.h"
+#include "cdr.h"
+#include "debug.h"
+#include "giop.h"
class ACE_Synchronous_Cancellation_Required
// = TITLE
@@ -85,7 +84,7 @@ private:
void
IIOP_Object::do_call (CORBA_Environment &env, // exception reporting
- const calldata *info, // call description
+ const TAO_Call_Data *info, // call description
...) // ... any parameters
{
@@ -130,7 +129,7 @@ IIOP_Object::do_call (CORBA_Environment &env, // exception reporting
// just one indirection.
u_int i;
- const paramdata *pdp;
+ const TAO_Param_Data *pdp;
va_list param_vector;
va_start (param_vector, info);
diff --git a/TAO/IIOP/lib/object.cpp b/TAO/IIOP/lib/object.cpp
index 671f9bf16f6..8a6fe2e6cf6 100644
--- a/TAO/IIOP/lib/object.cpp
+++ b/TAO/IIOP/lib/object.cpp
@@ -19,13 +19,13 @@
// GET_INTERFACE ... send a simple call to the object, it returns
// an InterfaceDef objref.
-static const paramdata Object_get_interface_params [] =
+static const TAO_Param_Data Object_get_interface_params [] =
{
{ _tc_CORBA_Object, PARAM_RETURN, 0 }
// XXX should be tc_InterfaceDef
};
-static const calldata Object_get_interface_calldata =
+static const TAO_Call_Data Object_get_interface_calldata =
{
"_interface",
CORBA_B_TRUE,
@@ -68,13 +68,13 @@ CORBA_Object::_get_interface (CORBA_Environment &env)
// IS_A ... ask the object if it's an instance of the type whose
// logical type ID is passed as a parameter.
-static const paramdata Object_is_a_params [] =
+static const TAO_Param_Data Object_is_a_params [] =
{
{ _tc_CORBA_Boolean, PARAM_RETURN, 0 },
{ _tc_CORBA_String, PARAM_IN, 0 }
};
-static const calldata Object_is_a_calldata =
+static const TAO_Call_Data Object_is_a_calldata =
{
"_is_a", CORBA_B_TRUE,
2, &Object_is_a_params [0],
@@ -132,13 +132,13 @@ CORBA_Object::_is_a (const CORBA_Char *type_id,
// GET_IMPLEMENTATION ... send a simple call to the object, it returns
// an ImplementationDef objref.
-static const paramdata Object_get_implementation_params [] =
+static const TAO_Param_Data Object_get_implementation_params [] =
{
{ _tc_CORBA_Object, PARAM_RETURN, 0 }
// XXX should be tc_ImplementationDef
};
-static const calldata Object_get_implementation_calldata =
+static const TAO_Call_Data Object_get_implementation_calldata =
{
"_implementation",
CORBA_B_TRUE,
@@ -169,12 +169,12 @@ CORBA_Object::_get_implementation (CORBA_Environment &env)
// either elicit a FALSE response or a OBJECT_NOT_EXIST exception. In
// the latter case, return FALSE.
-static const paramdata Object_non_existent_params [] =
+static const TAO_Param_Data Object_non_existent_params [] =
{
{ _tc_CORBA_Boolean, PARAM_RETURN, 0 }
};
-static const calldata Object_non_existent_calldata =
+static const TAO_Call_Data Object_non_existent_calldata =
{
"_non_existent", CORBA_B_TRUE,
1, &Object_non_existent_params [0],
diff --git a/TAO/IIOP/lib/objtable.cpp b/TAO/IIOP/lib/objtable.cpp
index 0ca0a9ea65e..535839bdb2e 100644
--- a/TAO/IIOP/lib/objtable.cpp
+++ b/TAO/IIOP/lib/objtable.cpp
@@ -73,17 +73,18 @@ TAO_Linear_ObjTable::find (const CORBA_OctetSeq &key,
for (CORBA_ULong i = 0;
i < this->next_;
- i++;
+ i++)
{
if (!ACE_OS::memcmp (key.buffer, this->tbl_[i].key.buffer, key.length))
{
obj = this->tbl_[i].obj;
return 1;
}
+ }
return -1; // not found
}
-TAO_Linear_ObjTable_Entry::TAO_Linear_ObjTable_Entry ()
+TAO_Linear_ObjTable_Entry::TAO_Linear_ObjTable_Entry(void)
{
this->key.buffer = 0;
this->key.length = this->key.maximum = 0;
diff --git a/TAO/IIOP/lib/optable.h b/TAO/IIOP/lib/optable.h
index f148b45d14a..b0cdb7634ed 100644
--- a/TAO/IIOP/lib/optable.h
+++ b/TAO/IIOP/lib/optable.h
@@ -141,8 +141,6 @@ private:
TAO_Active_Demux_OpTable_Entry *tbl_;
};
-// @@ Please prefix these classes with TAO_...
-
class TAO_Operation_Table_Parameters
{
public:
@@ -167,7 +165,7 @@ private:
DEMUX_STRATEGY type_;
};
-typedef ACE_Singleton<OpTable_Parameters, ACE_RW_Mutex> TAO_OP_TABLE_PARAMETERS;
+typedef ACE_Singleton<TAO_Operation_Table_Parameters, ACE_RW_Mutex> TAO_OP_TABLE_PARAMETERS;
class TAO_Operation_Table_Factory
{
diff --git a/TAO/IIOP/lib/orbobj.cpp b/TAO/IIOP/lib/orbobj.cpp
index 93650b2ca07..ae56129ac3f 100644
--- a/TAO/IIOP/lib/orbobj.cpp
+++ b/TAO/IIOP/lib/orbobj.cpp
@@ -67,8 +67,6 @@ CORBA_ORB::Release (void)
// registry. Registry will be used to assign orb names and to
// establish which is the default.
-static CORBA_ORB_ptr the_orb;
-
CORBA_ORB_ptr
CORBA_ORB_init (int &argc,
char *const *argv,
@@ -162,8 +160,8 @@ CORBA_ORB_init (int &argc,
return 0;
// Inititalize the "ORB" pseudo-object now.
- the_orb = TAO_ORB::instance ();
- the_orb->use_omg_ior_format (use_ior);
+ IIOP_ORB_ptr the_orb = TAO_ORB::instance ();
+ the_orb->use_omg_ior_format (CORBA_Boolean(use_ior));
return the_orb;
}
@@ -179,8 +177,8 @@ CORBA_ORB::create_list (CORBA_Long count,
if (count != 0) {
retval->_len = 0;
retval->_max = (u_int) count;
- retval->_values = (CORBA_NamedValue_ptr) ACEO_OS::calloc ((u_int) count,
- sizeof (CORBA_NamedValue));
+ retval->_values = (CORBA_NamedValue_ptr) ACE_OS::calloc ((u_int) count,
+ sizeof (CORBA_NamedValue));
}
}
@@ -194,7 +192,7 @@ CORBA_ORB::create_list (CORBA_Long count,
CORBA_ORB_ptr
_orb (void)
{
- return the_orb;
+ return TAO_ORB::instance();
}
CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
@@ -222,9 +220,12 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
while (i < argc)
{
- // @@ Can you please add comments describing each of these options?
+ // @@ Can you please add comments describing each of these options? --doug
+ // @@ Andy, could you review these since you wrote the code --cjc
+
if (ACE_OS::strcmp (argv[i], "-OAid") == 0)
{
+ // Specify the name of the OA
if (i + 1 < argc)
id = CORBA_string_dup (argv[i + 1]);
@@ -235,6 +236,8 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
}
else if (ACE_OS::strcmp (argv[i], "-OAhost") == 0)
{
+ // Specify the name of the host (i.e., interface) on which
+ // the server should listen
if (i + 1 < argc)
host = CORBA_string_dup (argv[i + 1]);
@@ -245,7 +248,9 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
}
else if (ACE_OS::strcmp (argv[i], "-OAport") == 0)
{
+ // Specify the port number/name on which we should listen
if (i + 1 < argc)
+ // @@ We shouldn't limit this to being specified as an int! --cjc
port = ACE_OS::atoi (argv[i + 1]);
for (int j = i ; j + 2 < argc ; j++)
@@ -255,6 +260,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
}
else if (ACE_OS::strcmp (argv[i], "-OAobjdemux") == 0)
{
+ // Specify the demultiplexing strategy to be used for object demultiplexing
if (i + 1 < argc)
demux = CORBA_string_dup (argv[i+1]);
@@ -265,6 +271,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
}
else if (ACE_OS::strcmp (argv[i], "-OAtablesize") == 0)
{
+ // @@ Specify the table size used for ????
if (i + 1 < argc)
tablesize = ACE_OS::atoi (argv[i+1]);
@@ -275,12 +282,15 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
}
else if (ACE_OS::strcmp (argv[i], "-OArcvsock") == 0)
{
+ // Specify the size of the socket's receive buffer
}
else if (ACE_OS::strcmp (argv[i], "-OAsndsock") == 0)
{
+ // Specify the size of the socket's send buffer
}
else if (ACE_OS::strcmp (argv[i], "-OAthread") == 0)
{
+ // Specify whether or not threads should be used.
use_threads = CORBA_B_TRUE;
for (int j = i ; j + 1 < argc ; j++)
argv[j] = argv[j + 1];
diff --git a/TAO/IIOP/lib/orbobj.i b/TAO/IIOP/lib/orbobj.i
index d47a62708ea..ca40e34f760 100644
--- a/TAO/IIOP/lib/orbobj.i
+++ b/TAO/IIOP/lib/orbobj.i
@@ -1,3 +1,5 @@
+// $Id$
+
// Constructor and destructor are accessible to subclasses
ACE_INLINE
CORBA_ORB::CORBA_ORB (void)
@@ -49,3 +51,24 @@ CORBA_ORB::AddRef (void)
return _refcount++;
}
+
+ACE_INLINE
+TAO_Client_Factory&
+CORBA_ORB::client_factory(void)
+{
+ return client_factory_;
+}
+
+ACE_INLINE
+TAO_Server_Factory&
+CORBA_ORB::server_factory(void)
+{
+ return server_factory_;
+}
+
+ACE_INLINE
+TAO_ORB_Parameters&
+CORBA_ORB::params(void)
+{
+ return params_;
+}
diff --git a/TAO/IIOP/lib/params.h b/TAO/IIOP/lib/params.h
index 879ca092106..16c4e66d38f 100644
--- a/TAO/IIOP/lib/params.h
+++ b/TAO/IIOP/lib/params.h
@@ -30,8 +30,6 @@ class ROA;
typedef ROA* ROA_ptr;
class TAO_OA_Connection_Handler;
-// @@ Please prefix all these classes with TAO_...
-
class TAO_ORB_Parameters
// = TITLE
// Parameters that are specific to the ORB. These parameters can be
@@ -121,8 +119,7 @@ public:
ACE_INET_Addr addr (void);
// Get the address on which we're listening.
- // @@ CAn you please finish documenting these methods?
- void demux_strategy (char *strategy);
+ void demux_strategy (const char *strategy);
// Specify the demultiplexing strategy to be used via <{strategy}>.
// Valid values are one of (case matters) "linear", "dynamic_hash",
// "user_def", or "active_demux". If the value is not valid, then
diff --git a/TAO/IIOP/lib/params.i b/TAO/IIOP/lib/params.i
index ecf129839db..d5bd8f53f31 100644
--- a/TAO/IIOP/lib/params.i
+++ b/TAO/IIOP/lib/params.i
@@ -100,9 +100,9 @@ TAO_OA_Parameters::demux_strategy (DEMUX_STRATEGY strategy)
}
ACE_INLINE
-void TAO_OA_Parameters::demux_strategy (char* strategy)
+void TAO_OA_Parameters::demux_strategy (const char* strategy)
{
- // @@ Can you please add a comment for this?
+ // Determine the demux strategy based on the given name
if (!ACE_OS::strcmp (strategy, "linear"))
{
this->demux_ = TAO_LINEAR;
diff --git a/TAO/IIOP/lib/request.cpp b/TAO/IIOP/lib/request.cpp
index c5aa1bbde9b..73d96e1d111 100644
--- a/TAO/IIOP/lib/request.cpp
+++ b/TAO/IIOP/lib/request.cpp
@@ -4,14 +4,13 @@
//
// Implementation of Dynamic Invocation Interface
//
-#include <orb.h>
-#include <stub.h>
+#include <orb.h>
+#include <stub.h>
-#include <initguid.h>
+#include <initguid.h>
-#include "debug.h"
-#include "cdr.h"
-#include "thread.h"
+#include "debug.h"
+#include "cdr.h"
// {77420085-F276-11ce-9598-0000C07CA898}
DEFINE_GUID (IID_CORBA_Request,
diff --git a/TAO/IIOP/lib/roa.cpp b/TAO/IIOP/lib/roa.cpp
index a3b00ed70a4..cd900e8dfc3 100644
--- a/TAO/IIOP/lib/roa.cpp
+++ b/TAO/IIOP/lib/roa.cpp
@@ -65,7 +65,7 @@ ROA::ROA (CORBA_ORB_ptr owning_orb,
// Initialize the endpoint ... or try!
if (client_acceptor_.open (p->addr (),
ACE_Service_Config::reactor (),
- fn.creation_strategy (),
+ f.creation_strategy (),
f.accept_strategy (),
f.concurrency_strategy (),
f.scheduling_strategy ()) == -1)
@@ -655,6 +655,6 @@ request_forwarder (opaque &target_key,
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
// Direct
-template class ACE_Strategy_Acceptor<ROA_Handler, ACE_SOCK_ACCEPTOR>;
+template class ACE_Strategy_Acceptor<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>;
// Indirect
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/TAO/IIOP/lib/stub.h b/TAO/IIOP/lib/stub.h
index 0409e2f79e5..867a6fd48f7 100644
--- a/TAO/IIOP/lib/stub.h
+++ b/TAO/IIOP/lib/stub.h
@@ -6,7 +6,7 @@
// TAO
//
// = FILENAME
-// thread.h
+// stub.h
//
// = DESCRIPTION
//
@@ -24,7 +24,10 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-//
+//
+// = VERSION
+// $Id$
+//
// ============================================================================
#if !defined (TAO_STUB_H)
@@ -37,7 +40,7 @@
// Descriptions of parameters.
-enum param_type
+enum TAO_Param_Type
// = TITLE
// Parameter mode of a given parameter.
{
@@ -47,7 +50,7 @@ enum param_type
PARAM_RETURN // = PARAM_OUT
};
-struct paramdata
+struct TAO_Param_Data
// = TITLE
// Description of a single parameter.
//
@@ -71,14 +74,14 @@ struct paramdata
CORBA_TypeCode_ptr tc;
// Type of param.
- param_type mode;
+ TAO_Param_Type mode;
// Its mode.
size_t value_size;
// zero or tc->size ().
};
-struct calldata
+struct TAO_Call_Data
// = TITLE
// Descriptions of operations, as used by the stub interpreter. Only
// interpretive marshaling/unmarshaling is used, and the stubs don't
@@ -103,7 +106,7 @@ struct calldata
u_int param_count;
// # parameters.
- const paramdata *params;
+ const TAO_Param_Data *params;
// Their descriptions.
// The exceptions allowed by this operation can be listed in any
@@ -133,11 +136,11 @@ struct calldata
//
// typedef void (*skeleton)(CORBA_ServerRequest &, CORBA_Environment &);
-struct skel_entry
+struct TAO_Skel_Entry
// = TITLE
// table of these per implementation
{
- const calldata *op_descriptor;
+ const TAO_Call_Data *op_descriptor;
TAO_Skeleton impl_skeleton;
};
@@ -156,7 +159,7 @@ class ACE_Svc_Export STUB_Object : public IUnknown
{
public:
virtual void do_call (CORBA_Environment &env,
- const calldata *info,
+ const TAO_Call_Data *info,
...) = 0;
// The "stub interpreter" method parameters are:
//
diff --git a/TAO/IIOP/lib/svrrqst.cpp b/TAO/IIOP/lib/svrrqst.cpp
index 70603d80ab6..4dc7c3cbdba 100644
--- a/TAO/IIOP/lib/svrrqst.cpp
+++ b/TAO/IIOP/lib/svrrqst.cpp
@@ -4,15 +4,14 @@
//
// Implementation of the Dynamic Server Skeleton Interface
-#include <orb.h>
+#include <orb.h>
-#include <initguid.h>
+#include <initguid.h>
-#include "debug.h"
-#include "thread.h"
-#include "cdr.h"
+#include "debug.h"
+#include "cdr.h"
-#include "svrrqst.h"
+#include "svrrqst.h"
// {77420086-F276-11ce-9598-0000C07CA898}
DEFINE_GUID (IID_IIOP_ServerRequest,
@@ -22,6 +21,10 @@ DEFINE_GUID (IID_IIOP_ServerRequest,
DEFINE_GUID(IID_CORBA_ServerRequest,
0x4b48d881, 0xf7f0, 0x11ce, 0x95, 0x98, 0x0, 0x0, 0xc0, 0x7c, 0xa8, 0x98);
+#if !defined(__ACE_INLINE__)
+# include "svrrqst.i"
+#endif
+
IIOP_ServerRequest::~IIOP_ServerRequest (void)
{
assert (_refcount == 0);
diff --git a/TAO/IIOP/lib/svrrqst.h b/TAO/IIOP/lib/svrrqst.h
index f2388fd4df9..1293f76a151 100644
--- a/TAO/IIOP/lib/svrrqst.h
+++ b/TAO/IIOP/lib/svrrqst.h
@@ -6,7 +6,7 @@
// TAO
//
// = FILENAME
-// thread.h
+// svrrqst.h
//
// = DESCRIPTION
//
@@ -15,6 +15,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
+//
+// = VERSION
+// $Id$
//
// ============================================================================
@@ -83,19 +86,9 @@ class ACE_Svc_Export IIOP_ServerRequest : public CORBA_ServerRequest
public:
// Constructor, destructor
- // @@ This code should be moved to the *.i file.
IIOP_ServerRequest (CDR *msg,
CORBA_ORB_ptr the_orb,
- CORBA_BOA_ptr the_boa)
- : _incoming (msg),
- _params (0),
- _retval (0),
- _exception (0),
- _ex_type (NO_EXCEPTION),
- _refcount (1),
- _orb (the_orb),
- _boa (the_boa)
- {}
+ CORBA_BOA_ptr the_boa);
virtual ~IIOP_ServerRequest (void);
@@ -147,4 +140,8 @@ private:
CORBA_BOA_ptr _boa;
};
+# if defined(__ACE_INLINE__)
+# include "svrrqst.i"
+# endif
+
#endif /* TAO_SVRRQST_H */
diff --git a/TAO/IIOP/lib/svrrqst.i b/TAO/IIOP/lib/svrrqst.i
new file mode 100644
index 00000000000..ab918b979a6
--- /dev/null
+++ b/TAO/IIOP/lib/svrrqst.i
@@ -0,0 +1,13 @@
+ACE_INLINE
+IIOP_ServerRequest::IIOP_ServerRequest(CDR *msg,
+ CORBA_ORB_ptr the_orb,
+ CORBA_BOA_ptr the_boa)
+ : _incoming (msg),
+ _params (0),
+ _retval (0),
+ _exception (0),
+ _ex_type (NO_EXCEPTION),
+ _refcount (1),
+ _orb (the_orb),
+ _boa (the_boa)
+{}
diff --git a/TAO/IIOP/lib/thread.h b/TAO/IIOP/lib/thread.h
deleted file mode 100644
index 63bf1573251..00000000000
--- a/TAO/IIOP/lib/thread.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// thread.h
-//
-// = DESCRIPTION
-//
-// Simple thread utility classes
-//
-// = AUTHOR
-// Copyright 1994-1995 by Sun Microsystems, Inc.
-//
-// ============================================================================
-
-// @@ Please remove this file...
-
-// Instances of these classes are placed at the beginning of a lexical
-// scope to ensure that all exits from that scope restore thread or
-// synchronization state to its original values. Thread state
-// includes ansynchronous cancellability, synchronization state
-// includes locks that cover data structures that are shared between
-// threads.
-//
-// NOTE: supports only POSIX and SVR4 threads for the moment. Win32
-// threads can be supported sometime later.
-
-#ifndef _THREAD_HH
-#define _THREAD_HH
-
-#ifdef unix
-#include <unistd.h> // may define _POSIX_THREADS
-#endif // unix
-
-#ifdef _POSIX_THREADS
-#include <pthread.h>
-
-//
-// This ugliness is called for by OSF/1 v3.0, which defines the POSIX.1c
-// symbol "_POSIX_THREADS" even though it is noncompliant.
-//
-// We make the assumption that PTHREAD_MUTEX_INITIALIXER is a preprocessor
-// symbol, although POSIX does not require that, since since it works on
-// all the POSIX.1c implementations we've seen.
-//
-# ifndef PTHREAD_MUTEX_INITIALIZER
-# undef _POSIX_THREADS
-# endif // not really POSIX.1c threads
-#endif
-
-//
-// Use native threading on Solaris 2.2 and later.
-//
-// XXX this is a temporary kluge; "autoconf" should kick in the
-// appropriate POSIX threads emulation when it's not native.
-//
-#if defined (sun) && !defined (_POSIX_THREADS) && !defined (FAKE_POSIX_THREADS)
-# define FAKE_POSIX_THREADS
-#endif // 2.2 <= "solaris version < 2.5
-
-
-#ifdef FAKE_POSIX_THREADS
-//
-// To use SVR4 native threads, enable FAKE_POSIX_THREADS. This is
-// intentionally not autoconfigured, since it's only really needed on
-// Solaris versions before 2.5. POSIX threads are the way to go
-// longer term, on all compliant platforms.
-//
-// NOTE: this is only a partial implementation !!! Enough to make
-// the IIOP engine work as it's coded as of 9-Aug-95. If you start
-// to use different POSIX options, these macros could stop working.
-//
-#define _POSIX_THREADS // only as much as is defined here!
-
-#include <thread.h>
-#include <synch.h>
-
-typedef thread_t pthread_t;
-typedef mutex_t pthread_mutex_t;
-typedef cond_t pthread_cond_t;
-typedef unsigned long pthread_attr_t;
-typedef thread_key_t pthread_key_t;
-
-
-#define PTHREAD_MUTEX_INITIALIZER DEFAULTMUTEX
-#define PTHREAD_COND_INITIALIZER DEFAULTCV
-
-#define pthread_mutex_lock mutex_lock
-#define pthread_mutex_unlock mutex_unlock
-#define pthread_cond_wait cond_wait
-
-struct pthread_once_t {
- mutex_t lock;
- int called_once;
-};
-
-#define PTHREAD_ONCE_INIT { DEFAULTMUTEX, 0 }
-
-inline void
-pthread_once (pthread_once_t *var, void (*fn)())
-{
- ACE_OS::mutex_lock (&var->lock);
- if (var->called_once == 0) {
- (fn)();
- var->called_once = 1;
- }
- ACE_OS::mutex_unlock (&var->lock);
-}
-
-#define pthread_self thr_self
-
-#define pthread_key_create thr_keycreate
-#define pthread_attr_init(ap) ((*ap) = 0)
-#define pthread_attr_setdetachstate(ap,v) ((*ap) |= (v))
-
-#define PTHREAD_CREATE_DETACHED THR_DETACHED
-
-inline void *
-pthread_getspecific (pthread_key_t key)
-{
- void *vp;
-
- ACE_OS::thr_getspecific (key, &vp);
- return vp;
-}
-
-#define pthread_setspecific thr_setspecific
-
-inline int
-pthread_create (
- pthread_t *tidp,
- pthread_attr_t *attrs,
- void *(func)(void *),
- void *arg
-)
-{
- return ACE_OS::thr_create (0, 0, func, arg, *attrs, tidp);
-}
-
-#endif // FAKE_POSIX_THREADS
-
-
-#ifdef _POSIX_THREADS
-//
-// Stick one of these at the beginning of a block that hosts a critical
-// section, passing it a pointer to the lock guarding that section. The
-// destructor will release it on all code paths, eliminating one class of
-// common threading errors.
-//
-class Critical {
- public:
- Critical (pthread_mutex_t *l) : lock (l)
- { enter (); }
-
- ~Critical ()
- { leave (); }
-
- void leave ()
- { (void) pthread_mutex_unlock (lock); }
- void enter ()
- { (void) pthread_mutex_lock (lock); }
- void pause (pthread_cond_t *condition)
- { (void) pthread_cond_wait (condition, lock); }
-
- private:
- pthread_mutex_t *lock;
-};
-
-
-//
-// Stick one of these at the beginning of a block that can't support
-// asynchronous cancellation, and which must be cancel-safe.
-//
-class ForceSynchronousCancel {
- public:
- //
- // MIT Pthreads 1.60 doesn't include cancellation; this is good, it
- // gives time to ensure that stack unwinding for cancellation (in C)
- // interoperates with unwinding for C++ exceptions so that both
- // resource reclamation systems interwork correctly.
- //
-#ifdef PTHREAD_CANCEL_DEFERRED
- ForceSynchronousCancel ()
- { (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old_type); }
-
- ~ForceSynchronousCancel ()
- { (void) pthread_setcanceltype (old_type, &old_type); }
-
- private:
- int old_type;
-#endif // PTHREAD_CANCEL_DEFERRED
-};
-
-#endif // _POSIX_THREADS
-
-#endif // _THREAD_HH
diff --git a/TAO/IIOP/lib/typecode.cpp b/TAO/IIOP/lib/typecode.cpp
index 8185473e57a..a8a7d7624c8 100644
--- a/TAO/IIOP/lib/typecode.cpp
+++ b/TAO/IIOP/lib/typecode.cpp
@@ -16,21 +16,20 @@
// only mutual exclusion relates to reference counting and
// construction.
-#include <assert.h>
-#include <limits.h>
-#include <string.h>
-#include <orb.h>
+#include <assert.h>
+#include <limits.h>
+#include <string.h>
+#include <orb.h>
-#include "debug.h"
-#include "cdr.h"
-#include "thread.h"
+#include "debug.h"
+#include "cdr.h"
#if !defined (VXWORKS)
-#include <memory.h>
+#include <memory.h>
#endif
-#include <sys/types.h>
+#include <sys/types.h>
-#include <initguid.h>
+#include <initguid.h>
void