diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-09-23 11:49:04 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-09-23 11:49:04 -0230 |
commit | 83ede0edd22a3debf30779780a1070dfe01fc88e (patch) | |
tree | fa0dfa8b58243364b76c55d93443a7cff4f92631 /cpp | |
parent | bug 4217 - improve __cmp__ method in Python generated code (diff) | |
download | ice-83ede0edd22a3debf30779780a1070dfe01fc88e.tar.bz2 ice-83ede0edd22a3debf30779780a1070dfe01fc88e.tar.xz ice-83ede0edd22a3debf30779780a1070dfe01fc88e.zip |
Bug 3972 - reduced trace level for some output and other minor cleanup
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/IceUtil/StringUtil.h | 6 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Ice/TcpAcceptor.cpp | 21 | ||||
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.cpp | 22 | ||||
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.h | 1 | ||||
-rw-r--r-- | cpp/src/IceSSL/AcceptorI.cpp | 24 | ||||
-rw-r--r-- | cpp/src/IceUtil/StringUtil.cpp | 15 |
7 files changed, 45 insertions, 64 deletions
diff --git a/cpp/include/IceUtil/StringUtil.h b/cpp/include/IceUtil/StringUtil.h index 72f061e311e..5ddf12b890d 100644 --- a/cpp/include/IceUtil/StringUtil.h +++ b/cpp/include/IceUtil/StringUtil.h @@ -27,7 +27,6 @@ ICE_UTIL_API std::string escapeString(const std::string&, const std::string&); // ICE_UTIL_API bool unescapeString(const std::string&, std::string::size_type, std::string::size_type, std::string&); - // // Split a string using the given delimiters. Considers single and double quotes; // returns false for unbalanced quote, true otherwise. @@ -35,6 +34,11 @@ ICE_UTIL_API bool unescapeString(const std::string&, std::string::size_type, std ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&); // +// Join a list of strings using the given delimiter. +// +ICE_UTIL_API std::string joinString(const std::vector<std::string>&, const std::string&); + +// // Trim white space // ICE_UTIL_API std::string trim(const std::string&); diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 6f3081d7ae6..926c5ec11f3 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -1199,25 +1199,17 @@ ObjectAdapterI::parsePublishedEndpoints() { // // If the PublishedEndpoints property isn't set, we compute the published enpdoints - // from the OA endpoints. + // from the OA endpoints, expanding any endpoints that may be listening on INADDR_ANY + // to include actual addresses in the published endpoints. // - transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), - back_inserter(endpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint)); - - // - // Expand any endpoints that may be listening on INADDR_ANY to include actual - // addresses in the published endpoints. - // - vector<EndpointIPtr> expandedEndpoints; - for(unsigned int i = 0; i < endpoints.size(); ++i) + for(unsigned int i = 0; i < _incomingConnectionFactories.size(); ++i) { - vector<EndpointIPtr> endps = endpoints[i]->expand(); - expandedEndpoints.insert(expandedEndpoints.end(), endps.begin(), endps.end()); + vector<EndpointIPtr> endps = _incomingConnectionFactories[i]->endpoint()->expand(); + endpoints.insert(endpoints.end(), endps.begin(), endps.end()); } - endpoints = expandedEndpoints; } - if(_instance->traceLevels()->network >= 3) + if(_instance->traceLevels()->network >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); out << "published endpoints for object adapter `" << getName() << "':\n"; diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp index 453d0cbccc1..1b0e4251ba5 100644 --- a/cpp/src/Ice/TcpAcceptor.cpp +++ b/cpp/src/Ice/TcpAcceptor.cpp @@ -15,6 +15,7 @@ #include <Ice/Network.h> #include <Ice/Exception.h> #include <Ice/Properties.h> +#include <IceUtil/StringUtil.h> #ifdef ICE_USE_IOCP # include <Mswsock.h> @@ -71,22 +72,12 @@ IceInternal::TcpAcceptor::listen() Trace out(_logger, _traceLevels->networkCat); out << "accepting tcp connections at " << toString(); - if(_traceLevels->network >= 3) + vector<string> interfaces = + getHostsForEndpointExpand(inetAddrToString(_addr), _instance->protocolSupport(), true); + if(!interfaces.empty()) { - vector<string> interfaces = - getHostsForEndpointExpand(inetAddrToString(_addr), _instance->protocolSupport(), true); - if(!interfaces.empty()) - { - out << "\nlocal interfaces: "; - for(unsigned int i = 0; i < interfaces.size(); ++i) - { - if(i != 0) - { - out << ", "; - } - out << interfaces[i]; - } - } + out << "\nlocal interfaces: "; + out << IceUtilInternal::joinString(interfaces, ", "); } } } diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 30e4f7a8c07..8196391e00b 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -24,6 +24,7 @@ #include <Ice/Network.h> #include <Ice/LocalException.h> #include <Ice/Properties.h> +#include <IceUtil/StringUtil.h> using namespace std; using namespace Ice; @@ -475,7 +476,6 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), - _protocolSupport(instance->protocolSupport()), _incoming(false), _addr(addr), _connect(true), @@ -515,7 +515,6 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), - _protocolSupport(instance->protocolSupport()), _incoming(true), _addr(getAddressForServer(host, port, instance->protocolSupport())), _connect(connect), @@ -584,21 +583,12 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s Trace out(_logger, _traceLevels->networkCat); out << "starting to receive udp packets\n" << toString(); - if(_traceLevels->network >= 3) + vector<string> interfaces = + getHostsForEndpointExpand(inetAddrToString(_addr), instance->protocolSupport(), true); + if(!interfaces.empty()) { - vector<string> interfaces = getHostsForEndpointExpand(inetAddrToString(_addr), _protocolSupport, true); - if(!interfaces.empty()) - { - out << "\nlocal interfaces: "; - for(unsigned int i = 0; i < interfaces.size(); ++i) - { - if(i != 0) - { - out << ", "; - } - out << interfaces[i]; - } - } + out << "\nlocal interfaces: "; + out << IceUtilInternal::joinString(interfaces, ", "); } } } diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h index df86f0c9e9c..4eb1a14bfbe 100644 --- a/cpp/src/Ice/UdpTransceiver.h +++ b/cpp/src/Ice/UdpTransceiver.h @@ -72,7 +72,6 @@ private: const TraceLevelsPtr _traceLevels; const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; - const ProtocolSupport _protocolSupport; const bool _incoming; const struct sockaddr_storage _addr; struct sockaddr_storage _mcastAddr; diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp index 005ce765e74..c82a77dc4dc 100644 --- a/cpp/src/IceSSL/AcceptorI.cpp +++ b/cpp/src/IceSSL/AcceptorI.cpp @@ -18,6 +18,7 @@ #include <Ice/LoggerUtil.h> #include <Ice/Network.h> #include <Ice/Properties.h> +#include <IceUtil/StringUtil.h> #ifdef ICE_USE_IOCP # include <Mswsock.h> @@ -75,25 +76,14 @@ IceSSL::AcceptorI::listen() Trace out(_logger, _instance->networkTraceCategory()); out << "accepting ssl connections at " << toString(); - if(_instance->networkTraceLevel() >= 3) + vector<string> interfaces = + IceInternal::getHostsForEndpointExpand(IceInternal::inetAddrToString(_addr), _instance->protocolSupport(), + true); + if(!interfaces.empty()) { - vector<string> interfaces = - IceInternal::getHostsForEndpointExpand(IceInternal::inetAddrToString(_addr), - _instance->protocolSupport(), true); - if(!interfaces.empty()) - { - out << "\nlocal interfaces: "; - for(unsigned int i = 0; i < interfaces.size(); ++i) - { - if(i != 0) - { - out << ", "; - } - out << interfaces[i]; - } - } + out << "\nlocal interfaces: "; + out << IceUtilInternal::joinString(interfaces, ", "); } - } } diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index b83d6dc8a79..2b79f251360 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -369,6 +369,21 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri return true; } +string +IceUtilInternal::joinString(const std::vector<std::string>& values, const std::string& delimiter) +{ + ostringstream out; + for(unsigned int i = 0; i < values.size(); i++) + { + if(i != 0) + { + out << delimiter; + } + out << values[i]; + } + return out.str(); +} + // // Trim white space (" \t\r\n") // |