From d6e7b4ae3258bb650bf45e43afc1234171ec8e82 Mon Sep 17 00:00:00 2001 From: bala Date: Thu, 11 Apr 2002 22:28:02 +0000 Subject: ChangeLogTag: Thu Apr 11 17:26:21 2002 Balachandran Natarajan --- TAO/tao/ChangeLog | 11 ++ TAO/tao/IIOP_Connector.cpp | 8 +- TAO/tao/Strategies/DIOP_Connector.cpp | 7 - TAO/tao/Strategies/DIOP_Connector.h | 1 - TAO/tao/Strategies/SHMIOP_Connector.cpp | 153 ------------------- TAO/tao/Strategies/SHMIOP_Connector.h | 1 - TAO/tao/Strategies/UIOP_Connector.cpp | 251 ++++++++++++++++---------------- TAO/tao/Strategies/UIOP_Connector.h | 1 - 8 files changed, 139 insertions(+), 294 deletions(-) diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog index 651d707cc89..612b40291e7 100644 --- a/TAO/tao/ChangeLog +++ b/TAO/tao/ChangeLog @@ -1,3 +1,14 @@ +Thu Apr 11 17:26:21 2002 Balachandran Natarajan + + * tao/Strategies/SHMIOP_Connector.cpp: + * tao/Strategies/SHMIOP_Connector.h: + * tao/Strategies/UIOP_Connector.h: + * tao/Strategies/UIOP_Connector.cpp: + * tao/Strategies/DIOP_Connector.h: + * tao/Strategies/DIOP_Connector.cpp: Cleaned up left over + preconnect code. + + Thu Apr 11 14:36:37 2002 Balachandran Natarajan This checkin does the following diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 59c40313155..6ef748bb3e5 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -27,14 +27,12 @@ template class ACE_Connect_Strategy; template class ACE_Svc_Tuple; -/* -// TODO: Where are they needed? If not used needs to be removed. template class ACE_Map_Manager *, TAO_SYNCH_RW_MUTEX>; template class ACE_Map_Iterator_Base *, TAO_SYNCH_RW_MUTEX>; template class ACE_Map_Entry*>; template class ACE_Map_Iterator*,TAO_SYNCH_RW_MUTEX>; template class ACE_Map_Reverse_Iterator*,TAO_SYNCH_RW_MUTEX>; -*/ + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate TAO_Connect_Concurrency_Strategy @@ -44,15 +42,13 @@ template class ACE_Map_Reverse_Iterator #pragma instantiate ACE_Svc_Tuple -/* - * Where are they needed? #pragma instantiate ACE_Map_Manager *, TAO_SYNCH_RW_MUTEX> #pragma instantiate ACE_Map_Iterator_Base *, TAO_SYNCH_RW_MUTEX> #pragma instantiate ACE_Map_Entry*> #pragma instantiate ACE_Map_Iterator*,TAO_SYNCH_RW_MUTEX> #pragma instantiate ACE_Map_Reverse_Iterator*,TAO_SYNCH_RW_MUTEX> #pragma instantiate ACE_Auto_Basic_Array_Ptr -*/ + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp index 1f37cbdbc2e..8a08d9a9a9b 100644 --- a/TAO/tao/Strategies/DIOP_Connector.cpp +++ b/TAO/tao/Strategies/DIOP_Connector.cpp @@ -164,13 +164,6 @@ TAO_DIOP_Connector::connect (TAO_GIOP_Invocation *invocation, return 0; } -int -TAO_DIOP_Connector::preconnect (const char *) -{ - // @@ Michael: We do not support preconnects. - return 0; -} - TAO_Profile * TAO_DIOP_Connector::create_profile (TAO_InputCDR& cdr) { diff --git a/TAO/tao/Strategies/DIOP_Connector.h b/TAO/tao/Strategies/DIOP_Connector.h index c6ecf4f6c08..2e1f2ce3d93 100644 --- a/TAO/tao/Strategies/DIOP_Connector.h +++ b/TAO/tao/Strategies/DIOP_Connector.h @@ -55,7 +55,6 @@ public: int connect (TAO_GIOP_Invocation *invocation, TAO_Transport_Descriptor_Interface *desc ACE_ENV_ARG_DECL); - int preconnect (const char *preconnections); TAO_Profile *create_profile (TAO_InputCDR& cdr); virtual int check_prefix (const char *endpoint); diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp index 0b1bb5aa53c..14983eebd08 100644 --- a/TAO/tao/Strategies/SHMIOP_Connector.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp @@ -255,159 +255,6 @@ TAO_SHMIOP_Connector::connect (TAO_GIOP_Invocation *invocation, } -int -TAO_SHMIOP_Connector::preconnect (const char *preconnects) -{ -#if 0 - // Check for the proper protocol prefix. - if (this->check_prefix (preconnects) != 0) - return 0; // Failure: zero successful preconnections - - const char *protocol_removed = - ACE_OS::strstr (preconnects, - "://") + 3; - // "+ 3" since strlen of "://" is 3. - - char *preconnections = - ACE_OS::strdup (protocol_removed); - - int successes = 0; - if (preconnections) - { - ACE_INET_Addr dest; - ACE_Unbounded_Stack dests; - - size_t num_connections; - - char *nextptr = 0; - char *where = 0; - for (where = ACE::strsplit_r (preconnections, ",", nextptr); - where != 0; - where = ACE::strsplit_r (0, ",", nextptr)) - { - int version_offset = 0; - // Additional offset to remove version from preconnect, if it exists. - - if (isdigit (where[0]) && - where[1] == '.' && - isdigit (where[2]) && - where[3] == '@') - version_offset = 4; - - // @@ For now, we just drop the version prefix. However, at - // some point in the future the version may become useful. - - char *tport = 0; - char *thost = where + version_offset; - char *sep = ACE_OS::strchr (where, ':'); - - // @@ Notice we reuqire the host name in preconnect - // so the MEM_Connector can identify if we are trying - // to a local host or not. - - if (sep) - { - *sep = '\0'; - tport = sep + 1; - - dest.set ((u_short) ACE_OS::atoi (tport), thost); - dests.push (dest); - } - // @@ Skip the entry if we don't have a host:port pair available. - } - - // Create an array of addresses from the stack, as well as an - // array of eventual handlers. - num_connections = dests.size (); - ACE_INET_Addr *remote_addrs = 0; - TAO_SHMIOP_Connection_Handler **handlers = 0; - char *failures = 0; - - ACE_NEW_RETURN (remote_addrs, - ACE_INET_Addr[num_connections], - -1); - - ACE_Auto_Basic_Array_Ptr safe_remote_addrs (remote_addrs); - - ACE_NEW_RETURN (handlers, - TAO_SHMIOP_Connection_Handler *[num_connections], - -1); - - ACE_Auto_Basic_Array_Ptr - safe_handlers (handlers); - - ACE_NEW_RETURN (failures, - char[num_connections], - -1); - - // No longer need to worry about exception safety at this point. - remote_addrs = safe_remote_addrs.release (); - handlers = safe_handlers.release (); - - size_t slot = 0; - - // Fill in the remote address array - while (dests.pop (remote_addrs[slot]) == 0) - handlers[slot++] = 0; - - // Finally, try to connect. - this->base_connector_.connect_n (num_connections, - handlers, - remote_addrs, - failures); - // Loop over all the failures and set the handlers that - // succeeded to idle state. - for (slot = 0; - slot < num_connections; - slot++) - { - if (!failures[slot]) - { - TAO_SHMIOP_Endpoint endpoint (remote_addrs[slot]); - - TAO_Base_Transport_Property prop (&endpoint); - - // Add the handler to Cache - int retval = - this->orb_core ()->lane_resources ().transport_cache ().cache_transport (&prop, - handlers[slot]->transport ()); - successes++; - - if (retval != 0 && TAO_debug_level > 4) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) Unable to add handles\n"), - ACE_TEXT ("to cache \n"))); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) Preconnection <%s:%d> ") - ACE_TEXT ("succeeded.\n"), - remote_addrs[slot].get_host_name (), - remote_addrs[slot].get_port_number ())); - } - else if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) Preconnection <%s:%d> failed.\n"), - remote_addrs[slot].get_host_name (), - remote_addrs[slot].get_port_number ())); - } - - ACE_OS::free (preconnections); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) SHMIOP preconnections: %d successes and ") - ACE_TEXT ("%d failures.\n"), - successes, - num_connections - successes)); - } - return successes; -#else - ACE_UNUSED_ARG (preconnects); - ACE_NOTSUP_RETURN (-1); -#endif -} - TAO_Profile * TAO_SHMIOP_Connector::create_profile (TAO_InputCDR& cdr) { diff --git a/TAO/tao/Strategies/SHMIOP_Connector.h b/TAO/tao/Strategies/SHMIOP_Connector.h index ebd69280556..6262183722a 100644 --- a/TAO/tao/Strategies/SHMIOP_Connector.h +++ b/TAO/tao/Strategies/SHMIOP_Connector.h @@ -61,7 +61,6 @@ public: int connect (TAO_GIOP_Invocation *invocation, TAO_Transport_Descriptor_Interface *desc ACE_ENV_ARG_DECL); - int preconnect (const char *preconnections); TAO_Profile *create_profile (TAO_InputCDR& cdr); virtual int check_prefix (const char *endpoint); diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index 8b60c725163..3dff3014fc8 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -21,10 +21,6 @@ ACE_RCSID(Strategies, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Node; -template class ACE_Unbounded_Stack; -template class ACE_Auto_Basic_Array_Ptr; - template class TAO_Connect_Concurrency_Strategy; template class TAO_Connect_Creation_Strategy; template class ACE_Strategy_Connector; @@ -241,6 +237,131 @@ TAO_UIOP_Connector::connect (TAO_GIOP_Invocation *invocation, return 0; } + + +TAO_Profile * +TAO_UIOP_Connector::create_profile (TAO_InputCDR& cdr) +{ + TAO_Profile *pfile; + ACE_NEW_RETURN (pfile, + TAO_UIOP_Profile (this->orb_core ()), + 0); + + int r = pfile->decode (cdr); + if (r == -1) + { + pfile->_decr_refcnt (); + pfile = 0; + } + + return pfile; +} + +TAO_Profile * +TAO_UIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_Profile *profile = 0; + ACE_NEW_THROW_EX (profile, + TAO_UIOP_Profile (this->orb_core ()), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + + ACE_CHECK_RETURN (0); + + return profile; +} + +int +TAO_UIOP_Connector::check_prefix (const char *endpoint) +{ + // Check for a valid string + if (!endpoint || !*endpoint) + return -1; // Failure + + const char *protocol[] = { "uiop", "uioploc" }; + + size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; + + size_t len0 = ACE_OS::strlen (protocol[0]); + size_t len1 = ACE_OS::strlen (protocol[1]); + + // Check for the proper prefix in the IOR. If the proper prefix + // isn't in the IOR then it is not an IOR we can use. + if (slot == len0 + && ACE_OS::strncasecmp (endpoint, + protocol[0], + len0) == 0) + return 0; + else if (slot == len1 + && ACE_OS::strncasecmp (endpoint, + protocol[1], + len1) == 0) + return 0; + + return -1; + // Failure: not an UIOP IOR DO NOT throw an exception here. +} + +char +TAO_UIOP_Connector::object_key_delimiter (void) const +{ + return TAO_UIOP_Profile::object_key_delimiter_; +} + +int +TAO_UIOP_Connector::init_uiop_properties (void) +{ + // Connector protocol properties are obtained from ORB-level + // RTCORBA::ClientProtocolProperties policy override. + // If the override doesn't exist or doesn't contain the + // properties, we use ORB default. + // + // Currently, we do not use Object-level and Current-level policy + // overrides for protocol configuration because connection + // lookup and caching are not done based on protocol + // properties. + + ACE_DECLARE_NEW_CORBA_ENV; + + int send_buffer_size = this->orb_core ()->orb_params ()->sock_sndbuf_size (); + int recv_buffer_size = this->orb_core ()->orb_params ()->sock_rcvbuf_size (); + int no_delay = 0; + + TAO_Protocols_Hooks *tph = this->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (tph != 0) + { + const char protocol [] = "uiop"; + const char *protocol_type = protocol; + int hook_result = + tph->call_client_protocols_hook (send_buffer_size, + recv_buffer_size, + no_delay, + protocol_type); + + if(hook_result == -1) + return -1; + } + + // Extract and locally store properties of interest. + this->uiop_properties_.send_buffer_size = + send_buffer_size; + this->uiop_properties_.recv_buffer_size = + recv_buffer_size; + + return 0; +} + + +#if 0 +/* + * TODO Needs to be removed + * + */ int TAO_UIOP_Connector::preconnect (const char *preconnects) { @@ -376,126 +497,6 @@ TAO_UIOP_Connector::preconnect (const char *preconnects) return successes; } - -TAO_Profile * -TAO_UIOP_Connector::create_profile (TAO_InputCDR& cdr) -{ - TAO_Profile *pfile; - ACE_NEW_RETURN (pfile, - TAO_UIOP_Profile (this->orb_core ()), - 0); - - int r = pfile->decode (cdr); - if (r == -1) - { - pfile->_decr_refcnt (); - pfile = 0; - } - - return pfile; -} - -TAO_Profile * -TAO_UIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_Profile *profile = 0; - ACE_NEW_THROW_EX (profile, - TAO_UIOP_Profile (this->orb_core ()), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - - ACE_CHECK_RETURN (0); - - return profile; -} - -int -TAO_UIOP_Connector::check_prefix (const char *endpoint) -{ - // Check for a valid string - if (!endpoint || !*endpoint) - return -1; // Failure - - const char *protocol[] = { "uiop", "uioploc" }; - - size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; - - size_t len0 = ACE_OS::strlen (protocol[0]); - size_t len1 = ACE_OS::strlen (protocol[1]); - - // Check for the proper prefix in the IOR. If the proper prefix - // isn't in the IOR then it is not an IOR we can use. - if (slot == len0 - && ACE_OS::strncasecmp (endpoint, - protocol[0], - len0) == 0) - return 0; - else if (slot == len1 - && ACE_OS::strncasecmp (endpoint, - protocol[1], - len1) == 0) - return 0; - - return -1; - // Failure: not an UIOP IOR DO NOT throw an exception here. -} - -char -TAO_UIOP_Connector::object_key_delimiter (void) const -{ - return TAO_UIOP_Profile::object_key_delimiter_; -} - -int -TAO_UIOP_Connector::init_uiop_properties (void) -{ - // Connector protocol properties are obtained from ORB-level - // RTCORBA::ClientProtocolProperties policy override. - // If the override doesn't exist or doesn't contain the - // properties, we use ORB default. - // - // Currently, we do not use Object-level and Current-level policy - // overrides for protocol configuration because connection - // lookup and caching are not done based on protocol - // properties. - - ACE_DECLARE_NEW_CORBA_ENV; - - int send_buffer_size = this->orb_core ()->orb_params ()->sock_sndbuf_size (); - int recv_buffer_size = this->orb_core ()->orb_params ()->sock_rcvbuf_size (); - int no_delay = 0; - - TAO_Protocols_Hooks *tph = this->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - if (tph != 0) - { - const char protocol [] = "uiop"; - const char *protocol_type = protocol; - int hook_result = - tph->call_client_protocols_hook (send_buffer_size, - recv_buffer_size, - no_delay, - protocol_type); - - if(hook_result == -1) - return -1; - } - - // Extract and locally store properties of interest. - this->uiop_properties_.send_buffer_size = - send_buffer_size; - this->uiop_properties_.recv_buffer_size = - recv_buffer_size; - - return 0; -} - - - - +#endif /*if 0*/ #endif /* TAO_HAS_UIOP == 1 */ diff --git a/TAO/tao/Strategies/UIOP_Connector.h b/TAO/tao/Strategies/UIOP_Connector.h index e1511f82cea..3bc631d9423 100644 --- a/TAO/tao/Strategies/UIOP_Connector.h +++ b/TAO/tao/Strategies/UIOP_Connector.h @@ -65,7 +65,6 @@ public: int connect (TAO_GIOP_Invocation *invocation, TAO_Transport_Descriptor_Interface *desc ACE_ENV_ARG_DECL); - int preconnect (const char *preconnections); TAO_Profile *create_profile (TAO_InputCDR& cdr); virtual int check_prefix (const char *endpoint); -- cgit v1.2.1