From 6cd7c31bb728fe8e2511bc008a2426705ec4e1bf Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 23 Jan 2025 10:21:47 +0100 Subject: [PATCH 1/2] When no preferred interfaces directives are given we can directly return, saves a call to TAO_IIOP_Endpoint_get_ip_interfaces which is costly * TAO/tao/IIOP_Endpoint.cpp: --- TAO/tao/IIOP_Endpoint.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index 3389f4e5459a0..b04def130cd06 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -446,10 +446,18 @@ TAO_IIOP_Endpoint::find_preferred_interfaces ( const ACE_CString &csvPreferred, ACE_Vector &preferred) { + // When no preferred interfaces directives are given we can directly return + if(csvPreferred.length() == 0) + { + return; + } + ACE_Vector local_ips; TAO_IIOP_Endpoint_get_ip_interfaces (local_ips); if (local_ips.size () == 0) - return; + { + return; + } // The outer loop steps through each preferred interface directive // and chains a new endpoint if the remote interface matches the @@ -487,7 +495,7 @@ TAO_IIOP_Endpoint::find_preferred_interfaces ( // If it's a match, then it means we need to use any/all // local interface(s) that matches wild_local. const char *const wild_local_cstr = wild_local.c_str (); - bool found= false; + bool found = false; for (size_t i = 0u; i < local_ips.size (); ++i) { ACE_CString &ret = local_ips[i]; @@ -569,7 +577,7 @@ TAO_IIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint) dynamic_cast (other_endpoint); if (endpoint == nullptr) - return 0; + return false; return (this->port_ == endpoint->port_ && (ACE_OS::strcmp (this->host (), endpoint->host ()) == 0)); From 5a360b9fc20ab2847ddf9fba9ceca0de41cc0a73 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 23 Jan 2025 10:22:05 +0100 Subject: [PATCH 2/2] Const change * TAO/tao/IIOP_Endpoint.cpp: --- TAO/tao/IIOP_Endpoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index b04def130cd06..1fb89ffebf2f3 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -400,7 +400,7 @@ TAO_IIOP_Endpoint_get_ip_interfaces (ACE_Vector &local_ips) { ACE_INET_Addr* tmp = nullptr; size_t cnt = 0u; - int err = ACE::get_ip_interfaces (cnt, tmp); + int const err = ACE::get_ip_interfaces (cnt, tmp); if (err != 0) return; #if defined (ACE_HAS_IPV6)