diff options
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 16 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Generator_Parser.cpp | 108 | ||||
-rw-r--r-- | TAO/tao/Tagged_Profile.h | 48 | ||||
-rw-r--r-- | TAO/tao/Tagged_Profile.i | 22 |
4 files changed, 151 insertions, 43 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index b4697efff63..dff15b6f70b 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,19 @@ +Wed Feb 28 14:23:41 2001 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/Tagged_Profile.h: + * tao/Tagged_Profile.i: + * tao/TAgged_Profile.cpp: This class held an instance of + GIOP::IORAddressingInfo which in turn held an instance of + TAO_String_Manager. This was a source of allocation and + deallocation for every call along the critical path. We now rip + open the GIOP::IORAddressingInfo structure and store the + information that is just required like the <type_id> and the + <IOP::TaggedProfile>. + + * tao/GIOP_Message_Generator_Parser.cpp: Added code to do a lazy + evaluation of GIOP::IORAddressingInfo structure that we may + receive. These changes should fix the bugzilla bug #798. + Wed Feb 28 14:17:46 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tests/Makefile: Added AMI_Timeouts to the list of directories. diff --git a/TAO/tao/GIOP_Message_Generator_Parser.cpp b/TAO/tao/GIOP_Message_Generator_Parser.cpp index 9d53560d613..fc431c2436b 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser.cpp @@ -24,21 +24,21 @@ TAO_GIOP_Message_Generator_Parser::parse_reply ( if (!stream.read_ulong (params.request_id_)) { if (TAO_debug_level > 0) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply, \n ") ACE_TEXT ("extracting request id")), -1); } - // and the reply status type. status can be NO_EXCEPTION, + // and the reply status type. status can be NO_EXCEPTION, // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD // Cannot handle LOCATION_FORWARD_PERM here - CORBA::ULong rep_stat = 0; + CORBA::ULong rep_stat = 0; if (!stream.read_ulong (rep_stat)) { if (TAO_debug_level > 0) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply, \n ") ACE_TEXT ("extracting reply status")), -1); @@ -46,48 +46,48 @@ TAO_GIOP_Message_Generator_Parser::parse_reply ( } - // Pass the right Pluggable interface code to the transport layer + // Pass the right Pluggable interface code to the transport layer switch (rep_stat) { // Request completed successfully case TAO_GIOP_NO_EXCEPTION: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION; + TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION; break; // Request terminated with user exception case TAO_GIOP_USER_EXCEPTION: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION; + TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION; break; - // Request terminated with system exception + // Request terminated with system exception case TAO_GIOP_SYSTEM_EXCEPTION: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION; + TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION; break; // Reply is a location forward type case TAO_GIOP_LOCATION_FORWARD: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD; + TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD; break; // Reply is a location forward perm type - // @@For the time being the behaviour of the - // LOCATION_FORWARD_PERM would be similar to the - // LOCATION_FORWARD as there is a controversy surrounding the + // @@For the time being the behaviour of the + // LOCATION_FORWARD_PERM would be similar to the + // LOCATION_FORWARD as there is a controversy surrounding the // usage of this in the OMG. case TAO_GIOP_LOCATION_FORWARD_PERM: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD; + TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD; break; // Reply is a location forward type case TAO_GIOP_NEEDS_ADDRESSING_MODE: params.reply_status_ = - TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE; + TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE; break; default: if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%N|%l) Unknown reply status \n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%N|%l) Unknown reply status \n"))); } return 0; @@ -103,26 +103,26 @@ TAO_GIOP_Message_Generator_Parser::parse_locate_reply ( if (!cdr.read_ulong (params.request_id_)) { if (TAO_debug_level > 0) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t|%N|%l):parse_locate_reply, ") ACE_TEXT ("extracting request id \n")), -1); } - // and the reply status type. status can be NO_EXCEPTION, + // and the reply status type. status can be NO_EXCEPTION, // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD // Cannot handle LOCATION_FORWARD_PERM here - // Please note here that we are NOT converting to the Pluggable + // Please note here that we are NOT converting to the Pluggable // messaging layer exception as this is GIOP specific. Not many // messaging protocols have the locate_* messages. if (!cdr.read_ulong (params.reply_status_)) { if (TAO_debug_level > 0) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO N|(%P|%t|l) parse_locate_reply, ") - ACE_TEXT ("extracting reply status\n")), + ACE_TEXT ("extracting reply status\n")), -1); } @@ -217,17 +217,67 @@ TAO_GIOP_Message_Generator_Parser::unmarshall_ref_addr ( CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); - // Get the IOP::Tagged profile. - GIOP::IORAddressingInfo &addr_info = - profile_addr.addressing_info (); + /* + * The GIOP::IORAddressingInfo is defined as follows + * struct IORAddressingInfo + * { + * unsigned long selected_profile_index; + * IOP::IOR ior; + * }; + * + * and the IOP::IOR is defined to be + * struct IOR + * { + * string type_id; + * sequence<TaggedProfile> profiles; + * }; + */ + + // First read the profile index + CORBA::ULong prof_index = 0; + + hdr_status = + hdr_status && input.read_ulong (prof_index); + + // Set the value in TAO_Tagged_Profile + if (hdr_status) + profile_addr.profile_index (prof_index); + + // Get the length of the type_id + CORBA::Long id_length = 0; + hdr_status = hdr_status && input.read_long (id_length); + + if (hdr_status) + { + // Get the type_id + ACE_CString &type_id = + profile_addr.type_id (); + + type_id.set (input.rd_ptr (), + 0); + + input.skip_bytes (id_length); + } - hdr_status &= input>> addr_info; + // Unmarshall the sequnce of TaggedProfiles + IOP::IOR::_tao_seq_TaggedProfile ior_profiles; - IOP::TaggedProfile &tag = - addr_info.ior.profiles [addr_info.selected_profile_index]; + hdr_status &= input >> ior_profiles; + + // Get the IOP::Tagged profile. + IOP::TaggedProfile &tagged_profile = + profile_addr.tagged_profile (); + + // Get the right TaggedProfile from the <ior_profiles> + if (hdr_status) + { + tagged_profile = + ior_profiles [prof_index]; + } // Extract the object key from the TaggedProfile. - hdr_status &= profile_addr.extract_object_key (tag); + hdr_status &= + profile_addr.extract_object_key (tagged_profile); return hdr_status; } diff --git a/TAO/tao/Tagged_Profile.h b/TAO/tao/Tagged_Profile.h index 620ad39e385..aecbda08ada 100644 --- a/TAO/tao/Tagged_Profile.h +++ b/TAO/tao/Tagged_Profile.h @@ -22,7 +22,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/GIOPC.h" - +#include "ace/SString.h" /** * @class TAO_Tagged_Profile @@ -64,8 +64,15 @@ public: /// get the tagged_profile IOP::TaggedProfile &tagged_profile (void); - /// get the addressing info - GIOP::IORAddressingInfo &addressing_info (void); + /// Get/Set the profile index, that needs to be used in the + /// sequnce of TaggedProfiles contained IOP::IOR that is + /// receivedfrom the client. + CORBA::ULong profile_index (void); + void profile_index (CORBA::ULong ind); + + /// Accessor to the type_id contained in the IOP::IOR received from + /// the client. + ACE_CString &type_id (void); /// Extract the object key from the TaggedProfile and store it in /// <object_key_> @@ -81,12 +88,35 @@ private: /// The Tagged profile. This class would have the Tagged Profile IOP::TaggedProfile profile_; - /// The addressing info - GIOP::IORAddressingInfo addr_info_; - - // The above two declarations are not used in TAO as on date. It is - // here so that we can use this anyday. The object_key extracted - // from these would still be available in <object_key_>. + /* + * The GIOP::IORAddressingInfo is defined as follows + * struct IORAddressingInfo + * { + * unsigned long selected_profile_index; + * IOP::IOR ior; + * }; + * + * and the IOP::IOR is defined to be + * struct IOR + * { + * string type_id; + * sequence<TaggedProfile> profiles; + * }; + * The mapping for the type_id of type string is TAO_String_Manager + * which does lot of bad things like allocation on construction and + * a deallocation on destruction. This is bad along the critical + * path. So we will store this nested structure ripped open with the + * profile_index and the type_id with the TaggedProfile that is + * pointed to. + */ + + /// The profile index incase we receive a GIOP::IORAddressingInfo + /// information + CORBA::ULong profile_index_; + + /// The type_id in the IOP::IOR incase we receive the + /// GIOP::IORAddressingInfo information. + ACE_CString type_id_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/tao/Tagged_Profile.i b/TAO/tao/Tagged_Profile.i index cccf1d21463..99345085b95 100644 --- a/TAO/tao/Tagged_Profile.i +++ b/TAO/tao/Tagged_Profile.i @@ -1,12 +1,13 @@ // -*- C++ -*- // $Id$ -ACE_INLINE +ACE_INLINE TAO_Tagged_Profile::TAO_Tagged_Profile (TAO_ORB_Core *orb_core) : orb_core_ (orb_core), object_key_ (), profile_ (), - addr_info_ () + profile_index_ (0), + type_id_ () { } @@ -39,8 +40,19 @@ TAO_Tagged_Profile::tagged_profile (void) return this->profile_; } -ACE_INLINE GIOP::IORAddressingInfo & -TAO_Tagged_Profile::addressing_info (void) +ACE_INLINE CORBA::ULong +TAO_Tagged_Profile::profile_index (void) { - return this->addr_info_; + return this->profile_index_; +} +ACE_INLINE void +TAO_Tagged_Profile::profile_index (CORBA::ULong ind) +{ + this->profile_index_ = ind; +} + +ACE_INLINE ACE_CString & +TAO_Tagged_Profile::type_id (void) +{ + return this->type_id_; } |