From 84c6565ae1e5602a026bbf87cc0e228346a30a3c Mon Sep 17 00:00:00 2001 From: bala Date: Sat, 15 Jan 2000 00:08:48 +0000 Subject: *** empty log message *** --- TAO/tao/IIOP_Connect.cpp | 44 +++++++++++++++++++++++++++++++++++++------- TAO/tao/IIOP_Connect.h | 15 +++++++-------- TAO/tao/IIOP_Connector.cpp | 20 ++++++++++++++++++-- TAO/tao/IIOP_Factory.cpp | 2 ++ TAO/tao/IIOP_Factory.h | 1 + TAO/tao/IIOP_Profile.i | 2 +- TAO/tao/ORB.cpp | 5 ++--- TAO/tao/UIOP_Connect.cpp | 43 ++++++++++++++++++++++++++++++++++++------- TAO/tao/UIOP_Connect.h | 9 +++++---- TAO/tao/UIOP_Connector.cpp | 12 ++++++++++++ 10 files changed, 121 insertions(+), 32 deletions(-) diff --git a/TAO/tao/IIOP_Connect.cpp b/TAO/tao/IIOP_Connect.cpp index 8f0e3adb3e0..37bbab370ac 100644 --- a/TAO/tao/IIOP_Connect.cpp +++ b/TAO/tao/IIOP_Connect.cpp @@ -337,14 +337,10 @@ TAO_IIOP_Client_Connection_Handler (ACE_Thread_Manager *t, TAO_ORB_Core* orb_core) : TAO_IIOP_Handler_Base (t), transport_ (this, orb_core), - orb_core_ (orb_core) + orb_core_ (orb_core), + mesg_factory_ (0) { - // OK, Here is a small twist. By now the all the objecs cached in - // this class would have been constructed. But we would like to make - // the one of the objects, precisely the transport object a pointer - // to the Messaging object. So, we set this up properly by calling - // the messaging_init method on the transport. - this->transport_.messaging_init (& this->message_factory_); + //no-op } TAO_IIOP_Client_Connection_Handler::~TAO_IIOP_Client_Connection_Handler (void) @@ -538,6 +534,40 @@ TAO_IIOP_Client_Connection_Handler::handle_cleanup (void) return 0; } +int +TAO_IIOP_Client_Connection_Handler:: + init_mesg_protocol (CORBA::Octet major, + CORBA::Octet minor) +{ + if (minor > TAO_DEF_GIOP_MINOR) + minor = TAO_DEF_GIOP_MINOR; + switch (minor) + { + case 0: + ACE_NEW_RETURN (this->mesg_factory_, + TAO_GIOP_Message_Connector_10, + 0); + break; + case 1: + ACE_NEW_RETURN (this->mesg_factory_, + TAO_GIOP_Message_Connector_11, + 0); + break; + default: + if (TAO_debug_level > 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ASYS_TEXT ("(%N|%l|%p|%t) No matching minor version number \n")), + 0); + } + } + + // Make the transport know + this->transport_.messaging_init (this->mesg_factory_); + + return 1; +} + // **************************************************************** #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/IIOP_Connect.h b/TAO/tao/IIOP_Connect.h index eaca33d6398..c15655c7d79 100644 --- a/TAO/tao/IIOP_Connect.h +++ b/TAO/tao/IIOP_Connect.h @@ -33,7 +33,6 @@ #include "tao/IIOP_Transport.h" -// BALA Temporray include #include "tao/GIOP_Message_Acceptors.h" #include "tao/GIOP_Message_Connectors.h" @@ -97,6 +96,10 @@ public: virtual TAO_Transport *transport (void); // Return the transport objects + virtual int init_mesg_protocol (CORBA::Octet major, + CORBA::Octet minor); + // Assigns the right messaging protocol object based on the version + protected: int handle_cleanup (void); // This method deregisters the handler from the reactor and closes it. @@ -107,10 +110,8 @@ protected: TAO_ORB_Core *orb_core_; // Cached ORB Core. - //@@Added by Bala for the time being. This would change to the - // actual factory at a later date - TAO_GIOP_Message_Connector_11 message_factory_; - // ///////////////////// + TAO_GIOP_Message_Connectors *mesg_factory_; + // The Connector messaging factory }; // **************************************************************** @@ -171,10 +172,8 @@ protected: TAO_IIOP_Server_Transport transport_; // @@ New transport object reference. - //@@Added by Bala for the time being. This would change to the - // actual factory at a later date TAO_GIOP_Message_Acceptors acceptor_factory_; - // ///////////////////// + // Messaging acceptor factory TAO_ORB_Core *orb_core_; // Cached ORB Core. diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index b06b3667bbb..2c2bed63e18 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -489,6 +489,21 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile, return -1; } + // Now that we have the client connection handler object we need to + // set the right messaging protocol for the connection handler. + const TAO_GIOP_Version& version = iiop_profile->version (); + + if (result->init_mesg_protocol (version.major, + version.minor) == 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%N|%l|%p|%t) init_mesg_protocol () failed \n"))); + } + return -1; + } + transport = result->transport (); return 0; } @@ -658,7 +673,7 @@ TAO_IIOP_Connector::create_profile (TAO_InputCDR& cdr) pfile->_decr_refcnt (); pfile = 0; } - + return pfile; } @@ -679,7 +694,8 @@ TAO_IIOP_Connector::make_profile (const char *endpoint, CORBA::NO_MEMORY ()); ACE_CHECK; -} + + } int TAO_IIOP_Connector::check_prefix (const char *endpoint) diff --git a/TAO/tao/IIOP_Factory.cpp b/TAO/tao/IIOP_Factory.cpp index 84d22b9c27b..8547d9348dd 100644 --- a/TAO/tao/IIOP_Factory.cpp +++ b/TAO/tao/IIOP_Factory.cpp @@ -83,3 +83,5 @@ ACE_STATIC_SVC_DEFINE (TAO_IIOP_Protocol_Factory, 0) ACE_FACTORY_DEFINE (TAO, TAO_IIOP_Protocol_Factory) + + diff --git a/TAO/tao/IIOP_Factory.h b/TAO/tao/IIOP_Factory.h index 2ae5d65c20c..3cbe2908de8 100644 --- a/TAO/tao/IIOP_Factory.h +++ b/TAO/tao/IIOP_Factory.h @@ -29,6 +29,7 @@ class TAO_Export TAO_IIOP_Protocol_Factory : public TAO_Protocol_Factory { public: TAO_IIOP_Protocol_Factory (void); + virtual ~TAO_IIOP_Protocol_Factory (void); // = Service Configurator hooks. diff --git a/TAO/tao/IIOP_Profile.i b/TAO/tao/IIOP_Profile.i index 85121915ff3..bc461ad8c0d 100644 --- a/TAO/tao/IIOP_Profile.i +++ b/TAO/tao/IIOP_Profile.i @@ -57,7 +57,7 @@ TAO_IIOP_Profile::version (void) const } ACE_INLINE TAO_IIOP_Client_Connection_Handler *& -TAO_IIOP_Profile::hint(void) +TAO_IIOP_Profile::hint (void) { return this->hint_; } diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 271b907ca05..26d58660a4a 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1647,6 +1647,7 @@ CORBA_ORB::string_to_object (const char *str, CORBA::COMPLETED_NO), CORBA::Object::_nil ()); + if (ACE_OS::strncmp (str, file_prefix, sizeof file_prefix - 1) == 0) @@ -1741,7 +1742,6 @@ CORBA_ORB::ior_string_to_object (const char *str, ACE_CDR::mb_align (&mb); char *buffer = mb.rd_ptr (); - const char *tmp = str; size_t len = 0; @@ -1767,7 +1767,7 @@ CORBA_ORB::ior_string_to_object (const char *str, // Create deencapsulation stream ... then unmarshal objref from that // stream. - + int byte_order = *(mb.rd_ptr ()); mb.rd_ptr (1); mb.wr_ptr (len); @@ -1775,7 +1775,6 @@ CORBA_ORB::ior_string_to_object (const char *str, CORBA::Object_ptr objref = CORBA::Object::_nil (); stream >> objref; - return objref; } diff --git a/TAO/tao/UIOP_Connect.cpp b/TAO/tao/UIOP_Connect.cpp index bd84eba2db0..5032cac14ac 100644 --- a/TAO/tao/UIOP_Connect.cpp +++ b/TAO/tao/UIOP_Connect.cpp @@ -324,14 +324,10 @@ TAO_UIOP_Client_Connection_Handler (ACE_Thread_Manager *t, TAO_ORB_Core* orb_core) : TAO_UIOP_Handler_Base (t), transport_ (this, orb_core), - orb_core_ (orb_core) + orb_core_ (orb_core), + mesg_factory_ (0) { - // OK, Here is a small twist. By now the all the objecs cached in - // this class would have been constructed. But we would like to make - // the one of the objects, precisely the transport object a pointer - // to the Messaging object. So, we set this up properly by calling - // the messaging_init method on the transport. - this->transport_.messaging_init (& this->message_factory_); + //no-op } TAO_UIOP_Client_Connection_Handler::~TAO_UIOP_Client_Connection_Handler (void) @@ -510,6 +506,39 @@ TAO_UIOP_Client_Connection_Handler::handle_cleanup (void) return 0; } +int +TAO_UIOP_Client_Connection_Handler:: + init_mesg_protocol (CORBA::Octet major, + CORBA::Octet minor) +{ + if (minor > TAO_DEF_GIOP_MINOR) + minor = TAO_DEF_GIOP_MINOR; + switch (minor) + { + case 0: + ACE_NEW_RETURN (this->mesg_factory_, + TAO_GIOP_Message_Connector_10, + 0); + break; + case 1: + ACE_NEW_RETURN (this->mesg_factory_, + TAO_GIOP_Message_Connector_11, + 0); + break; + default: + if (TAO_debug_level > 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ASYS_TEXT ("(%N|%l|%p|%t) No matching minor version number \n")), + 0); + } + } + + + // Make the transport know + this->transport_.messaging_init (this->mesg_factory_); + return 1; +} // **************************************************************** #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/UIOP_Connect.h b/TAO/tao/UIOP_Connect.h index bee36b86097..6bcc5c93cd9 100644 --- a/TAO/tao/UIOP_Connect.h +++ b/TAO/tao/UIOP_Connect.h @@ -97,6 +97,9 @@ public: virtual TAO_Transport *transport (void); + virtual int init_mesg_protocol (CORBA::Octet major, + CORBA::Octet minor); + // Assigns the right messaging protocol object based on the version protected: int handle_cleanup (void); // This method deregisters the handler from the reactor and closes it. @@ -107,10 +110,8 @@ protected: TAO_ORB_Core *orb_core_; // Cached ORB Core. - //@@Added by Bala for the time being. This would change to the - // actual factory at a later date - TAO_GIOP_Message_Connector_11 message_factory_; - // ///////////////////// + TAO_GIOP_Message_Connectors *mesg_factory_; + // The Connector messaging factory }; // **************************************************************** diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp index 575446b2ca8..2b0ed09fc6a 100644 --- a/TAO/tao/UIOP_Connector.cpp +++ b/TAO/tao/UIOP_Connector.cpp @@ -488,6 +488,17 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile, return -1; } + const TAO_GIOP_Version& version = uiop_profile->version (); + + if (uiop_profile->hint ()->init_mesg_protocol (version.major, + version.minor) == 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%N|%l|%p|%t) init_mesg_protocol () failed \n"))); + } + } transport = result->transport (); return 0; @@ -652,6 +663,7 @@ TAO_UIOP_Connector::make_profile (const char *endpoint, CORBA::NO_MEMORY ()); ACE_CHECK; + } int -- cgit v1.2.1