summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2000-11-28 08:39:32 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2000-11-28 08:39:32 +0000
commitbf6ae0f40edfb7b5d9beb1a3ee2503ae416e5e6d (patch)
treef6cccc0cd815994e55d8730b2e7e6e3f143783e2
parentce276260f7de8165cd7f5e1356af8da22ff87b9a (diff)
downloadATCD-bf6ae0f40edfb7b5d9beb1a3ee2503ae416e5e6d.tar.gz
ChangeLogTag:Tue Nov 28 00:29:40 2000 Ossama Othman <ossama@uci.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a13
-rw-r--r--TAO/tao/Acceptor_Registry.cpp53
2 files changed, 62 insertions, 4 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 9e967c00740..47ffdea2f9b 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,16 @@
+Tue Nov 28 00:29:40 2000 Ossama Othman <ossama@uci.edu>
+
+ * tao/Acceptor_Registry.cpp (open):
+
+ Count the number of addrs in each "-ORBEndpoint" option. The
+ sum of those values should be the maximum number of acceptors
+ the acceptor registry should allocate space for. Previously,
+ a single addr was assumed to exist in each -ORBEndpoint option.
+ This fixes a segmentation fault that was occuring when multiple
+ addrs were specified in a single "-ORBEndpoint" command line
+ ORB option.
+ Reported by Jeff Greif <jgreif@befree.com>.
+
Mon Nov 27 17:24:14 2000 Priyanka Gontla <pgontla@ece.uci.edu>
* performance-tests/Latency/client.cpp:
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp
index aa2e7941983..b157f91620a 100644
--- a/TAO/tao/Acceptor_Registry.cpp
+++ b/TAO/tao/Acceptor_Registry.cpp
@@ -135,8 +135,6 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core,
// IOP1://addr1,addr2,...,addrN/;IOP2://addr1,...addrM/;...
TAO_EndpointSet endpoint_set = orb_core->orb_params ()->endpoints ();
- TAO_EndpointSetIterator endpoints = endpoint_set.begin ();
-
if (endpoint_set.is_empty ())
{
// No endpoints were specified, we let each protocol pick its
@@ -153,12 +151,58 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core,
-1);
}
+ // Count the maximum number of endpoints in the set. This will be
+ // the maximum number of acceptors that need to be created.
+ size_t acceptor_count = 0;
+ TAO_EndpointSetIterator endpts = endpoint_set.begin ();
+ for (ACE_CString *ep = 0;
+ endpts.next (ep) != 0;
+ endpts.advance ())
+ {
+ const ACE_CString &iop = (*ep);
+
+ // IOP://address1,address2
+ // ^ slot
+ int slot = iop.find ("://", 0);
+
+ if (slot == iop.npos)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Invalid endpoint specification: ")
+ ACE_TEXT ("<%s>.\n"),
+ iop.c_str ()));
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ ++acceptor_count; // We've got at least one acceptor so far.
+
+ // Now count the number of commas. That number will be the
+ // remaining number of endpoints in the current endpoint
+ // specification.
+ const char *ep_end =
+ ep->c_str () + ACE_OS_String::strlen (ep->c_str ());
+ for (const char *e = ACE_OS_String::strchr (ep->c_str (), ',');
+ e != 0 && e != ep_end;
+ e = ACE_OS_String::strchr (e, ','))
+ {
+ ++acceptor_count;
+ ++e;
+ }
+ }
+
// The array containing the TAO_Acceptors will never contain more
// than the number of endpoints stored in TAO_ORB_Parameters.
if (this->acceptors_ == 0)
{
ACE_NEW_THROW_EX (this->acceptors_,
- TAO_Acceptor *[endpoint_set.size ()],
+ TAO_Acceptor *[acceptor_count],
CORBA::NO_MEMORY (
CORBA_SystemException::_tao_minor_code (
TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
@@ -167,11 +211,12 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core,
ACE_CHECK_RETURN (-1);
}
+ TAO_EndpointSetIterator endpoints = endpoint_set.begin ();
for (ACE_CString *endpoint = 0;
endpoints.next (endpoint) != 0;
endpoints.advance ())
{
- ACE_CString iop = (*endpoint);
+ const ACE_CString &iop = (*endpoint);
// IOP://address1,address2
// ^ slot