diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-02-14 19:37:14 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-02-14 19:37:14 +0000 |
commit | 8a2a3ea3817eb0f82347594eece49847ee07c06c (patch) | |
tree | 8d0111759a92ca5093a3e02126cf14bddd2d117e | |
parent | d7048b16e20f40da2676d25422d7f44875cc0f24 (diff) | |
download | ATCD-8a2a3ea3817eb0f82347594eece49847ee07c06c.tar.gz |
ChangeLogTag:Wed Feb 14 11:34:55 2001 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 38 | ||||
-rw-r--r-- | TAO/tao/CORBALOC_Parser.cpp | 129 | ||||
-rw-r--r-- | TAO/tao/CORBALOC_Parser.h | 21 | ||||
-rw-r--r-- | TAO/tao/Pluggable.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/orbconf.h | 24 | ||||
-rwxr-xr-x | TAO/tests/InterOp-Naming/run_test.pl | 30 |
6 files changed, 145 insertions, 100 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 4862808492b..da18627d102 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,41 @@ +Wed Feb 14 11:34:55 2001 Ossama Othman <ossama@uci.edu> + + * tao/Pluggable.cpp (make_mprofile): + + Decrease the reference count on the profile before returning + with an exception on error. Fixes a memory leak. + + * tao/CORBALOC_Parser.h (parse_string_mprofile_helper): + * tao/CORBALOC_Parser.cpp (parse_string_mprofile_helper): + + Changed CORBA::String_var parameter that was passed in by copy + to a const char *. There was no point in passing in a + CORBA::String_var. + + Added missing ACE_CHECK macro. + + (make_stub_from_mprofile, parse_string_rir_helper ): + + Fixed potential memory leak and improved exception safety. + + (parse_string): + + Removed unnecessary use of a CORBA::ORB_var, in addition to the + useless duplication of the ORB reference. + + * tao/orbconf.h: + + Removed "PriorityMappingManager" from the list of initial + services. There is no need to list it in the static initial + services since it is registered when the RTCORBA support is + loaded into the ORB. + + * tests/InterOp-Naming/run_test.pl: + + Updated test script to excercise additional INS features to make + it possible to catch more problems in TAO's INS support, should + they exist. + Wed Feb 14 13:00:28 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tao/IIOP_Profile.h: diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp index e5db10dbeef..1ee8997107f 100644 --- a/TAO/tao/CORBALOC_Parser.cpp +++ b/TAO/tao/CORBALOC_Parser.cpp @@ -3,14 +3,16 @@ #include "CORBALOC_Parser.h" #include "ORB_Core.h" #include "Stub.h" +#include "MProfile.h" #include "Connector_Registry.h" -#include "tao/IIOP_Endpoint.h" #if !defined(__ACE_INLINE__) #include "CORBALOC_Parser.i" #endif /* __ACE_INLINE__ */ -ACE_RCSID(tao, CORBALOC_Parser, "$Id$") +ACE_RCSID (TAO, + CORBALOC_Parser, + "$Id$") TAO_CORBALOC_Parser::~TAO_CORBALOC_Parser (void) { @@ -54,7 +56,7 @@ TAO_CORBALOC_Parser::parse_string_count_helper (const char * &corbaloc_name, ACE_TEXT ("TAO (%P|%t) Invalid Syntax\n"))); ACE_THROW (CORBA::BAD_PARAM (TAO_OMG_VMCID | - TAO_OMG_MINOR_BAD_PARAM_10, + TAO_OMG_MINOR_BAD_PARAM_10, CORBA::COMPLETED_NO)); } } @@ -81,7 +83,7 @@ TAO_CORBALOC_Parser::assign_key_string (char * &cloc_name_ptr, ACE_CString &key_string, CORBA::ULong &addr_list_length, - CORBA::ORB_ptr orb_var, + CORBA::ORB_ptr orb, TAO_MProfile &mprofile, CORBA::Environment &ACE_TRY_ENV) @@ -106,7 +108,7 @@ TAO_CORBALOC_Parser::assign_key_string (char * &cloc_name_ptr, if (ACE_OS::strncmp (cloc_name_ptr, protocol_prefix, - sizeof (protocol_prefix)-1) == 0) + sizeof (protocol_prefix) - 1) == 0) { // If there is no protocol explicitly specified, it defaults // down to <iiop:> ... so allocate memory even for that and @@ -127,8 +129,10 @@ TAO_CORBALOC_Parser::assign_key_string (char * &cloc_name_ptr, ACE_OS::strcat (end_point, protocol_suffix_append); - ACE_CString host_name_port = cloc_name_cstring.substring (pos_colon+1, - -1); + ACE_CString host_name_port = + cloc_name_cstring.substring (pos_colon + 1, + -1); + ACE_OS::strcat (end_point, host_name_port.c_str ()); @@ -163,14 +167,15 @@ TAO_CORBALOC_Parser::assign_key_string (char * &cloc_name_ptr, // The End_point will now be 'iiop://' - ACE_CString host_name_port = cloc_name_cstring.substring (pos_colon+1, - -1); + ACE_CString host_name_port = + cloc_name_cstring.substring (pos_colon + 1, -1); ACE_OS::strcat (end_point, host_name_port.c_str ()); // Example: - // The End_point will now be 'iiop://doc.ece.uci.edu:12345' + // The End_point will now be of the form + // 'iiop://1.0@doc.ece.uci.edu:12345' } @@ -194,13 +199,13 @@ TAO_CORBALOC_Parser::assign_key_string (char * &cloc_name_ptr, ACE_OS::strcat (end_point, key_string.c_str ()); - // Example: The End_point will now be - // 'iiop://doc.ece.uci.edu:12345/object_name' + // Example: The End_point will now be of the form: + // 'iiop://1.0@doc.ece.uci.edu:12345/object_name' // Call the mprofile helper which makes an mprofile for this // endpoint and adds it to the big mprofile. - this->parse_string_mprofile_helper (end_point, - orb_var, + this->parse_string_mprofile_helper (end_point.in (), + orb, mprofile, ACE_TRY_ENV); ACE_CHECK; @@ -210,9 +215,8 @@ void TAO_CORBALOC_Parser::parse_string_assign_helper (CORBA::ULong &addr_list_length, ACE_CString &key_string, - ACE_CString - &cloc_name, - CORBA::ORB_ptr orb_var, + ACE_CString &cloc_name, + CORBA::ORB_ptr orb, TAO_MProfile &mprofile, CORBA::Environment &ACE_TRY_ENV) @@ -231,12 +235,12 @@ TAO_CORBALOC_Parser::parse_string_assign_helper (CORBA::ULong while (cloc_name_ptr != 0) { // Forms the endpoint and calls the mprofile_helper. - assign_key_string (cloc_name_ptr, - key_string, - addr_list_length, - orb_var, - mprofile, - ACE_TRY_ENV); + this->assign_key_string (cloc_name_ptr, + key_string, + addr_list_length, + orb, + mprofile, + ACE_TRY_ENV); ACE_CHECK; // Get the next token. @@ -248,26 +252,24 @@ TAO_CORBALOC_Parser::parse_string_assign_helper (CORBA::ULong void -TAO_CORBALOC_Parser::parse_string_mprofile_helper (CORBA::String_var - end_point, - CORBA::ORB_ptr orb_var, - TAO_MProfile &mprofile, - CORBA::Environment - &ACE_TRY_ENV) +TAO_CORBALOC_Parser::parse_string_mprofile_helper ( + const char * end_point, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - /// = new TAO_MProfile; TAO_MProfile jth_mprofile; int retv = - orb_var->orb_core ()->connector_registry ()->make_mprofile( - end_point.in (), - jth_mprofile, - ACE_TRY_ENV); + orb->orb_core ()->connector_registry ()->make_mprofile (end_point, + jth_mprofile, + ACE_TRY_ENV); + ACE_CHECK; if (retv != 0) { - ACE_THROW(CORBA::INV_OBJREF ( + ACE_THROW (CORBA::INV_OBJREF ( CORBA_SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, EINVAL), @@ -287,29 +289,27 @@ TAO_CORBALOC_Parser::parse_string_mprofile_helper (CORBA::String_var } CORBA::Object_ptr -TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb_var, +TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb, TAO_MProfile &mprofile, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::Object_ptr obj = CORBA::Object::_nil (); - - // Now make the TAO_Stub. + // Create a TAO_Stub. TAO_Stub *data = 0; ACE_NEW_THROW_EX (data, TAO_Stub ((const char *) 0, mprofile, - orb_var->orb_core ()), - CORBA::NO_MEMORY ( - CORBA_SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); + orb->orb_core ()), + CORBA::NO_MEMORY ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); ACE_CHECK_RETURN (CORBA::Object::_nil ()); TAO_Stub_Auto_Ptr safe_data (data); - obj = orb_var->orb_core ()->create_object (data); + CORBA::Object_var obj = orb->orb_core ()->create_object (data); if (!CORBA::is_nil (obj)) { @@ -318,7 +318,7 @@ TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb_var, (void) safe_data.release (); /// Return the object reference to the application. - return obj; + return obj._retn (); } /// Shouldnt come here: if so, return nil reference. @@ -328,11 +328,11 @@ TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb_var, CORBA::Object_ptr TAO_CORBALOC_Parser::parse_string_rir_helper (const char * &corbaloc_name, - CORBA::ORB_ptr orb_var, + CORBA::ORB_ptr orb, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::Object_ptr rir_obj = CORBA::Object::_nil (); + // "rir" protocol. Pass the key string as an // argument to the resolve_initial_references. @@ -345,11 +345,12 @@ TAO_CORBALOC_Parser::parse_string_rir_helper (const char * key_string = "NameService"; } - rir_obj = orb_var->resolve_initial_references (key_string, - ACE_TRY_ENV); + CORBA::Object_var rir_obj = + orb->resolve_initial_references (key_string, + ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - return rir_obj; + return rir_obj._retn (); } int @@ -383,19 +384,17 @@ TAO_CORBALOC_Parser::parse_string (const char *ior, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::ORB_var orb_var = CORBA::ORB::_duplicate (orb); - - /// One big mprofile which consists the profiles of all the endpoints. + /// MProfile which consists of the profiles for each endpoint. TAO_MProfile mprofile; - // Skip the prefix, we know it is there because this method in only - // called if <match_prefix> returns 1. + // Skip the prefix. We know it is there because this method is only + // called if match_prefix() returns 1. const char *corbaloc_name = ior + sizeof corbaloc_prefix - 1; CORBA::Object_ptr object = CORBA::Object::_nil (); - // No of endpoints + // Number of endpoints CORBA::ULong count_addr = 1; // Length of obj_addr_list @@ -412,12 +411,12 @@ TAO_CORBALOC_Parser::parse_string (const char *ior, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - // Convert corbaloc_name as a ACE_CString + // Convert corbaloc_name to an ACE_CString ACE_CString corbaloc_name_str (corbaloc_name, 0, 1); // Get the key_string which is a substring of corbaloc_name_str ACE_CString key_string = - corbaloc_name_str.substring ((addr_list_length+1), -1); + corbaloc_name_str.substring ((addr_list_length + 1), -1); // Copy the <obj_addr_list> to cloc_name. ACE_CString cloc_name (corbaloc_name, @@ -425,20 +424,20 @@ TAO_CORBALOC_Parser::parse_string (const char *ior, 0, 1); - // Get each endpoint: For each endpoint, make a mprofile and add - // it to the one big mprofile whose reference is passed to the + // Get each endpoint: For each endpoint, make a MProfile and add + // it to the main MProfile whose reference is passed to the // application this->parse_string_assign_helper (addr_list_length, key_string, cloc_name, - orb_var.in (), + orb, mprofile, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); // Create the stub for the mprofile and get the object reference // to it which is to be returned to the client application. - object = this->make_stub_from_mprofile (orb_var.in (), + object = this->make_stub_from_mprofile (orb, mprofile, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); @@ -447,7 +446,7 @@ TAO_CORBALOC_Parser::parse_string (const char *ior, { // RIR case: object = this->parse_string_rir_helper (corbaloc_name, - orb_var.in (), + orb, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); } diff --git a/TAO/tao/CORBALOC_Parser.h b/TAO/tao/CORBALOC_Parser.h index d4399129950..579de3bfdf1 100644 --- a/TAO/tao/CORBALOC_Parser.h +++ b/TAO/tao/CORBALOC_Parser.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -17,19 +18,14 @@ #include "tao/IOR_Parser.h" -// @@ Priyanka: notice how many includes I was able to remove. In -// general you should try to minimize the number of #includes in your -// .h files. In fact, I believe that once you remove the orb_ and -// mprofile_ fields below these two includes can go away too! -#include "tao/ORB.h" -#include "tao/MProfile.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Service_Config.h" +class TAO_MProfile; + /** * @class TAO_CORBALOC_Parser * @@ -78,11 +74,10 @@ private: * the Object represented by the key_string is obtained and passed * to the application. */ - virtual void - parse_string_mprofile_helper (CORBA::String_var end_point, - CORBA::ORB_ptr orb, - TAO_MProfile &mprofile, - CORBA::Environment &) + virtual void parse_string_mprofile_helper (const char * end_point, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile, + CORBA::Environment &) ACE_THROW_SPEC ((CORBA::SystemException)); /** @@ -108,7 +103,7 @@ private: virtual void parse_string_assign_helper (CORBA::ULong &addr_list_length, ACE_CString &key_string, ACE_CString &cloc_name, - CORBA::ORB_ptr orb_var, + CORBA::ORB_ptr orb, TAO_MProfile &mprofile, CORBA::Environment &) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp index b90bf7773e6..8b9b64e7fe5 100644 --- a/TAO/tao/Pluggable.cpp +++ b/TAO/tao/Pluggable.cpp @@ -173,7 +173,6 @@ TAO_Connector::make_mprofile (const char *string, this->make_profile (endpoint.c_str (), profile, ACE_TRY_ENV); - ACE_CHECK_RETURN (-1); // Failure: Problem during profile creation @@ -182,6 +181,8 @@ TAO_Connector::make_mprofile (const char *string, // Give up ownership of the profile. if (mprofile.give_profile (profile) == -1) { + profile->_decr_refcnt (); + ACE_THROW_RETURN (CORBA::INV_OBJREF ( CORBA_SystemException::_tao_minor_code ( TAO_MPROFILE_CREATION_ERROR, diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 4284cfc86d0..f1c7d95aa93 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -368,6 +368,13 @@ #define TAO_OBJID_PRIORITYMAPPINGMANAGER "PriorityMappingManager" #define TAO_OBJID_SECURITYCURRENT "SecurityCurrent" #define TAO_OBJID_TRANSACTIONCURRENT "TransactionCurrent" +#define TAO_OBJID_NOTIFICATIONSERVICE "NotificationService" +#define TAO_OBJID_TYPEDNOTIFICATIONSERVICE "TypedNotificationService" +#define TAO_OBJID_COMPONENTHOMEFINDER "ComponentHomeFinder" +#define TAO_OBJID_PSS "PSS" +#define TAO_OBJID_CODECFACTORY "CodecFactory" +#define TAO_OBJID_PICurrent "PICurrent" + // Comma separated list of the above ObjectIDs. // DO NOT include unimplemented services! @@ -387,8 +394,12 @@ TAO_OBJID_DYNANYFACTORY, \ TAO_OBJID_TYPECODEFACTORY, \ TAO_OBJID_RTORB, \ - TAO_OBJID_RTCURRENT, \ - TAO_OBJID_PRIORITYMAPPINGMANAGER + TAO_OBJID_RTCURRENT +// @@ Some initial references are added via other means, such as +// ORBInitInfo::register_initial_references(). Those should not be +// placed in the above list. Ideally, we should no longer need the +// above list once the above services register their references +// dynamically. // Service IDs for the services that are located through Multicast. enum MCAST_SERVICEID @@ -855,10 +866,11 @@ enum MCAST_SERVICEID #define TAO_MESSAGING_QUEUE_ORDER_POLICY_TYPE 35 // Control the default version of GIOP used by TAO. -// The ORB is always able to communicate with 1.0 and 1.1 servers, and -// it creates 1.1 endpoints (and profiles). If you need to talk to -// old clients that only understand 1.0 (and do not attempt to use 1.0 -// with 1.1 servers), then change the values below. +// The ORB is always able to communicate with 1.0, 1.1 and 1.2 +// servers, and it creates 1.2 endpoints (and profiles). If you need +// to talk to old clients that only understand 1.0 or 1.1 (and do not +// attempt to use 1.0 or 1.1 with 1.2 servers), then change the values +// below. #if !defined (TAO_DEF_GIOP_MAJOR) #define TAO_DEF_GIOP_MAJOR 1 #endif /* TAO_DEF_GIOP_MAJOR */ diff --git a/TAO/tests/InterOp-Naming/run_test.pl b/TAO/tests/InterOp-Naming/run_test.pl index f364abf05be..e07ec99a92a 100755 --- a/TAO/tests/InterOp-Naming/run_test.pl +++ b/TAO/tests/InterOp-Naming/run_test.pl @@ -20,8 +20,8 @@ print STDERR "\n\n==== InitRef test\n"; unlink $file; $SV = Process::Create ($EXEPREFIX."INS_test_server".$EXE_EXT, - "-ORBEndpoint iiop://$TARGETHOSTNAME:$port " - . " -i object_name -o $file"); + "-ORBEndpoint iiop://1.0@"."$TARGETHOSTNAME:$port " + . " -i object_name -o $file -ORBDottedDecimalAddresses 1"); if (ACE::waitforfile_timed ($file, 5) == -1) { print STDERR "ERROR: cannot find file <$file>\n"; @@ -32,7 +32,7 @@ if (ACE::waitforfile_timed ($file, 5) == -1) { $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " random_service " ."-ORBInitRef random_service=" - ."corbaloc:iiop:$TARGETHOSTNAME:$port/object_name"); + ."corbaloc::1.1@"."$TARGETHOSTNAME:$port/object_name"); $client = $CL->TimedWait (60); if ($client == -1) { @@ -48,7 +48,7 @@ print STDERR "\n\n==== InvalidName test\n"; $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " not_a_service " ."-ORBInitRef random_service=" - ."corbaloc:iiop:$TARGETHOSTNAME:$port/object_name"); + ."corbaloc:iiop:1.0@"."$TARGETHOSTNAME:$port/object_name"); $client = $CL->TimedWait (60); if ($client == -1) { @@ -64,7 +64,7 @@ print STDERR "\n\n==== DefaultInitRef test\n"; $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " object_name " . "-ORBDefaultInitRef" - ." corbaloc:iiop:$TARGETHOSTNAME:$port/"); + ." corbaloc:iiop:1.0@"."$TARGETHOSTNAME:$port/"); $client = $CL->TimedWait (60); if ($client == -1) { @@ -84,9 +84,9 @@ $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " random_service " . "-ORBInitRef random_service=" ."corbaloc:" - ."iiop:$TARGETHOSTNAME:$port1," - ."iiop:$TARGETHOSTNAME:$port2," - ."iiop:$TARGETHOSTNAME:$port" + ."iiop:1.0@"."$TARGETHOSTNAME:$port1," + .":1.0@"."$TARGETHOSTNAME:$port2," + ."iiop:1.0@"."$TARGETHOSTNAME:$port" ."/object_name"); $client = $CL->TimedWait (60); @@ -109,9 +109,9 @@ $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, . " -l " . "-ORBInitRef random_service=" . "corbaloc:" - . "iiop:$TARGETHOSTNAME:$port1," - . "iiop:$TARGETHOSTNAME:$port2," - . "iiop:$TARGETHOSTNAME:$port" + . "iiop:1.0@"."$TARGETHOSTNAME:$port1," + . "iiop:1.0@"."$TARGETHOSTNAME:$port2," + . "iiop:1.0@"."$TARGETHOSTNAME:$port" . "/object_name"); $client = $CL->TimedWait (60); @@ -129,9 +129,9 @@ $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " object_name " . "-ORBDefaultInitRef " ."corbaloc:" - ."iiop:$TARGETHOSTNAME:$port1," - ."iiop:$TARGETHOSTNAME:$port2," - ."iiop:$TARGETHOSTNAME:$port/"); + ."iiop:1.0@"."$TARGETHOSTNAME:$port1," + ."iiop:1.0@"."$TARGETHOSTNAME:$port2," + ."iiop:1.0@"."$TARGETHOSTNAME:$port/"); $client = $CL->TimedWait (60); if ($client == -1) { @@ -148,7 +148,7 @@ $CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, " object_name " . "-ORBDefaultInitRef " ."corbaloc:" - ."iiop:$TARGETHOSTNAME:$port/"); + ."iiop:1.0@"."$TARGETHOSTNAME:$port/"); $client = $CL->TimedWait (60); if ($client == -1) { |