diff options
48 files changed, 202 insertions, 227 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 55d33d5e77f..e661e2310bd 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,10 @@ Changes since version 3.0.1 --------------------------- +- If a proxy is not configured with a -h paramater, Ice will now + attempt to connect using all local interfaces. The loopback interface + (127.0.0.1) will only be tried if it is the only local interface present. + - Added the ability to specify alternate mappings for slice sequences other than std::vector. This is done through metadata in a similar way to which IceJ supports alternate sequence mappings. Please see the Ice diff --git a/cpp/include/Ice/EndpointFactory.h b/cpp/include/Ice/EndpointFactory.h index 7049caa086a..9aa7a9b3ece 100644 --- a/cpp/include/Ice/EndpointFactory.h +++ b/cpp/include/Ice/EndpointFactory.h @@ -27,7 +27,7 @@ public: virtual ::Ice::Short type() const = 0; virtual ::std::string protocol() const = 0; - virtual EndpointIPtr create(const std::string&, bool) const = 0; + virtual EndpointIPtr create(const std::string&) const = 0; virtual EndpointIPtr read(BasicStream*) const = 0; virtual void destroy() = 0; diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp index 0c11e9170dc..8536c6d0381 100644 --- a/cpp/src/Ice/EndpointFactoryManager.cpp +++ b/cpp/src/Ice/EndpointFactoryManager.cpp @@ -64,7 +64,7 @@ IceInternal::EndpointFactoryManager::get(Short type) const } EndpointIPtr -IceInternal::EndpointFactoryManager::create(const string& str, bool adapterEndp) const +IceInternal::EndpointFactoryManager::create(const string& str) const { IceUtil::Mutex::Lock sync(*this); // TODO: Necessary? @@ -98,7 +98,7 @@ IceInternal::EndpointFactoryManager::create(const string& str, bool adapterEndp) { if(_factories[i]->protocol() == protocol) { - return _factories[i]->create(str.substr(end), adapterEndp); + return _factories[i]->create(str.substr(end)); } } diff --git a/cpp/src/Ice/EndpointFactoryManager.h b/cpp/src/Ice/EndpointFactoryManager.h index 93f44710688..b51c3484bc6 100644 --- a/cpp/src/Ice/EndpointFactoryManager.h +++ b/cpp/src/Ice/EndpointFactoryManager.h @@ -28,7 +28,7 @@ public: void add(const EndpointFactoryPtr&); EndpointFactoryPtr get(::Ice::Short) const; - EndpointIPtr create(const std::string&, bool) const; + EndpointIPtr create(const std::string&) const; EndpointIPtr read(BasicStream*) const; private: diff --git a/cpp/src/Ice/EndpointI.h b/cpp/src/Ice/EndpointI.h index d7ab5450858..18a9c13f571 100644 --- a/cpp/src/Ice/EndpointI.h +++ b/cpp/src/Ice/EndpointI.h @@ -115,10 +115,9 @@ public: // // Expand endpoint out in to separate endpoints for each local - // host if endpoint was configured with no host set. This - // only applies for ObjectAdapter endpoints. + // host if endpoint was configured with no host set. // - virtual std::vector<EndpointIPtr> expand() const = 0; + virtual std::vector<EndpointIPtr> expand(bool) const = 0; // // Return whether the endpoint should be published in proxies diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 1932afdb59c..50449cf6c50 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -988,14 +988,14 @@ Ice::ObjectAdapterI::parseEndpoints(const string& str) const } string s = endpts.substr(beg, end - beg); - EndpointIPtr endp = _instance->endpointFactoryManager()->create(s, true); + EndpointIPtr endp = _instance->endpointFactoryManager()->create(s); if(endp == 0) { EndpointParseException ex(__FILE__, __LINE__); ex.str = s; throw ex; } - vector<EndpointIPtr> endps = endp->expand(); + vector<EndpointIPtr> endps = endp->expand(true); endpoints.insert(endpoints.end(), endps.begin(), endps.end()); ++end; diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 94baac6b428..102c75b7559 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -12,7 +12,7 @@ #include <Ice/LocalException.h> #include <Ice/Instance.h> #include <Ice/IdentityUtil.h> -#include <Ice/Endpoint.h> +#include <Ice/EndpointI.h> #include <Ice/EndpointFactoryManager.h> #include <Ice/RouterInfo.h> #include <Ice/LocatorInfo.h> @@ -435,10 +435,11 @@ IceInternal::ReferenceFactory::create(const string& str) } string es = s.substr(beg, end - beg); - EndpointIPtr endp = _instance->endpointFactoryManager()->create(es, false); + EndpointIPtr endp = _instance->endpointFactoryManager()->create(es); if(endp != 0) { - endpoints.push_back(endp); + vector<EndpointIPtr> endps = endp->expand(false); + endpoints.insert(endpoints.end(), endps.begin(), endps.end()); } else { diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 6959ca408cd..26e2a4317f6 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -33,7 +33,7 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin { } -IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& str, bool adapterEndp) : +IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& str) : _instance(instance), _port(0), _timeout(-1), @@ -144,17 +144,10 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost; if(_host.empty()) { - if(adapterEndp) - { - const_cast<string&>(_host) = "0.0.0.0"; - } - else - { - const_cast<string&>(_host) = getLocalHost(true); - } + const_cast<string&>(_host) = "0.0.0.0"; } } - else if(_host == "*" && adapterEndp) + else if(_host == "*") { const_cast<string&>(_host) = "0.0.0.0"; } @@ -306,7 +299,7 @@ IceInternal::TcpEndpointI::acceptor(EndpointIPtr& endp) const } vector<EndpointIPtr> -IceInternal::TcpEndpointI::expand() const +IceInternal::TcpEndpointI::expand(bool includeLoopback) const { vector<EndpointIPtr> endps; if(_host == "0.0.0.0") @@ -314,8 +307,11 @@ IceInternal::TcpEndpointI::expand() const vector<string> hosts = getLocalHosts(); for(unsigned int i = 0; i < hosts.size(); ++i) { - endps.push_back(new TcpEndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress, - hosts.size() == 1 || hosts[i] != "127.0.0.1")); + if(includeLoopback || hosts.size() == 1 || hosts[i] != "127.0.0.1") + { + endps.push_back(new TcpEndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress, + hosts.size() == 1 || hosts[i] != "127.0.0.1")); + } } } else @@ -519,9 +515,9 @@ IceInternal::TcpEndpointFactory::protocol() const } EndpointIPtr -IceInternal::TcpEndpointFactory::create(const std::string& str, bool adapterEndp) const +IceInternal::TcpEndpointFactory::create(const std::string& str) const { - return new TcpEndpointI(_instance, str, adapterEndp); + return new TcpEndpointI(_instance, str); } EndpointIPtr diff --git a/cpp/src/Ice/TcpEndpointI.h b/cpp/src/Ice/TcpEndpointI.h index b33b993c676..f3b1762a5ef 100644 --- a/cpp/src/Ice/TcpEndpointI.h +++ b/cpp/src/Ice/TcpEndpointI.h @@ -23,7 +23,7 @@ class TcpEndpointI : public EndpointI public: TcpEndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool, bool); - TcpEndpointI(const InstancePtr&, const std::string&, bool); + TcpEndpointI(const InstancePtr&, const std::string&); TcpEndpointI(BasicStream*); virtual void streamWrite(BasicStream*) const; @@ -41,7 +41,7 @@ public: virtual TransceiverPtr serverTransceiver(EndpointIPtr&) const; virtual ConnectorPtr connector() const; virtual AcceptorPtr acceptor(EndpointIPtr&) const; - virtual std::vector<EndpointIPtr> expand() const; + virtual std::vector<EndpointIPtr> expand(bool) const; virtual bool publish() const; virtual bool equivalent(const TransceiverPtr&) const; virtual bool equivalent(const AcceptorPtr&) const; @@ -82,7 +82,7 @@ public: virtual Ice::Short type() const; virtual std::string protocol() const; - virtual EndpointIPtr create(const std::string&, bool) const; + virtual EndpointIPtr create(const std::string&) const; virtual EndpointIPtr read(BasicStream*) const; virtual void destroy(); diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index ae091bbd437..69c9358fd5c 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -36,7 +36,7 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin { } -IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& str, bool adapterEndp) : +IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& str) : _instance(instance), _port(0), _protocolMajor(protocolMajor), @@ -264,17 +264,10 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost; if(_host.empty()) { - if(adapterEndp) - { - const_cast<string&>(_host) = "0.0.0.0"; - } - else - { - const_cast<string&>(_host) = getLocalHost(true); - } + const_cast<string&>(_host) = "0.0.0.0"; } } - else if(_host == "*" && adapterEndp) + else if(_host == "*") { const_cast<string&>(_host) = "0.0.0.0"; } @@ -471,7 +464,7 @@ IceInternal::UdpEndpointI::acceptor(EndpointIPtr& endp) const } vector<EndpointIPtr> -IceInternal::UdpEndpointI::expand() const +IceInternal::UdpEndpointI::expand(bool includeLoopback) const { vector<EndpointIPtr> endps; if(_host == "0.0.0.0") @@ -479,8 +472,11 @@ IceInternal::UdpEndpointI::expand() const vector<string> hosts = getLocalHosts(); for(unsigned int i = 0; i < hosts.size(); ++i) { - endps.push_back(new UdpEndpointI(_instance, hosts[i], _port, _connectionId, _compress, - hosts.size() == 1 || hosts[i] != "127.0.0.1")); + if(includeLoopback || hosts.size() == 1 || hosts[i] != "127.0.0.1") + { + endps.push_back(new UdpEndpointI(_instance, hosts[i], _port, _connectionId, _compress, + hosts.size() == 1 || hosts[i] != "127.0.0.1")); + } } } else @@ -740,9 +736,9 @@ IceInternal::UdpEndpointFactory::protocol() const } EndpointIPtr -IceInternal::UdpEndpointFactory::create(const std::string& str, bool adapterEndp) const +IceInternal::UdpEndpointFactory::create(const std::string& str) const { - return new UdpEndpointI(_instance, str, adapterEndp); + return new UdpEndpointI(_instance, str); } EndpointIPtr diff --git a/cpp/src/Ice/UdpEndpointI.h b/cpp/src/Ice/UdpEndpointI.h index b1bbae23875..465e4063b07 100644 --- a/cpp/src/Ice/UdpEndpointI.h +++ b/cpp/src/Ice/UdpEndpointI.h @@ -23,7 +23,7 @@ class UdpEndpointI : public EndpointI public: UdpEndpointI(const InstancePtr&, const std::string&, Ice::Int, const std::string&, bool, bool); - UdpEndpointI(const InstancePtr&, const std::string&, bool); + UdpEndpointI(const InstancePtr&, const std::string&); UdpEndpointI(BasicStream*); virtual void streamWrite(BasicStream*) const; @@ -41,7 +41,7 @@ public: virtual TransceiverPtr serverTransceiver(EndpointIPtr&) const; virtual ConnectorPtr connector() const; virtual AcceptorPtr acceptor(EndpointIPtr&) const; - virtual std::vector<EndpointIPtr> expand() const; + virtual std::vector<EndpointIPtr> expand(bool) const; virtual bool publish() const; virtual bool equivalent(const TransceiverPtr&) const; virtual bool equivalent(const AcceptorPtr&) const; @@ -86,7 +86,7 @@ public: virtual Ice::Short type() const; virtual std::string protocol() const; - virtual EndpointIPtr create(const std::string&, bool) const; + virtual EndpointIPtr create(const std::string&) const; virtual EndpointIPtr read(BasicStream*) const; virtual void destroy(); diff --git a/cpp/src/Ice/UnknownEndpointI.cpp b/cpp/src/Ice/UnknownEndpointI.cpp index 749bcf16585..2f46404c87f 100644 --- a/cpp/src/Ice/UnknownEndpointI.cpp +++ b/cpp/src/Ice/UnknownEndpointI.cpp @@ -122,7 +122,7 @@ IceInternal::UnknownEndpointI::acceptor(EndpointIPtr& endp) const } vector<EndpointIPtr> -IceInternal::UnknownEndpointI::expand() const +IceInternal::UnknownEndpointI::expand(bool loopback) const { assert(false); vector<EndpointIPtr> ret; diff --git a/cpp/src/Ice/UnknownEndpointI.h b/cpp/src/Ice/UnknownEndpointI.h index 4e5cf9e5fb3..cb654d47051 100644 --- a/cpp/src/Ice/UnknownEndpointI.h +++ b/cpp/src/Ice/UnknownEndpointI.h @@ -37,7 +37,7 @@ public: virtual TransceiverPtr serverTransceiver(EndpointIPtr&) const; virtual ConnectorPtr connector() const; virtual AcceptorPtr acceptor(EndpointIPtr&) const; - virtual std::vector<EndpointIPtr> expand() const; + virtual std::vector<EndpointIPtr> expand(bool) const; virtual bool publish() const; virtual bool equivalent(const TransceiverPtr&) const; virtual bool equivalent(const AcceptorPtr&) const; diff --git a/cpp/src/IceSSL/SslEndpointI.cpp b/cpp/src/IceSSL/SslEndpointI.cpp index 8ef6d52ef06..293b49abe0b 100644 --- a/cpp/src/IceSSL/SslEndpointI.cpp +++ b/cpp/src/IceSSL/SslEndpointI.cpp @@ -33,7 +33,7 @@ IceSSL::SslEndpointI::SslEndpointI(const OpenSSLPluginIPtr& plugin, const string { } -IceSSL::SslEndpointI::SslEndpointI(const OpenSSLPluginIPtr& plugin, const string& str, bool adapterEndp) : +IceSSL::SslEndpointI::SslEndpointI(const OpenSSLPluginIPtr& plugin, const string& str) : _plugin(plugin), _port(0), _timeout(-1), @@ -144,17 +144,10 @@ IceSSL::SslEndpointI::SslEndpointI(const OpenSSLPluginIPtr& plugin, const string const_cast<string&>(_host) = _plugin->getProtocolPluginFacade()->getDefaultHost(); if(_host.empty()) { - if(adapterEndp) - { - const_cast<string&>(_host) = "0.0.0.0"; - } - else - { - const_cast<string&>(_host) = getLocalHost(true); - } + const_cast<string&>(_host) = "0.0.0.0"; } } - else if(_host == "*" && adapterEndp) + else if(_host == "*") { const_cast<string&>(_host) = "0.0.0.0"; } @@ -306,7 +299,7 @@ IceSSL::SslEndpointI::acceptor(EndpointIPtr& endp) const } vector<EndpointIPtr> -IceSSL::SslEndpointI::expand() const +IceSSL::SslEndpointI::expand(bool includeLoopback) const { vector<EndpointIPtr> endps; if(_host == "0.0.0.0") @@ -314,8 +307,11 @@ IceSSL::SslEndpointI::expand() const vector<string> hosts = getLocalHosts(); for(unsigned int i = 0; i < hosts.size(); ++i) { - endps.push_back(new SslEndpointI(_plugin, hosts[i], _port, _timeout, _connectionId, _compress, - hosts.size() == 1 || hosts[i] != "127.0.0.1")); + if(includeLoopback || hosts.size() == 1 || hosts[i] != "127.0.0.1") + { + endps.push_back(new SslEndpointI(_plugin, hosts[i], _port, _timeout, _connectionId, _compress, + hosts.size() == 1 || hosts[i] != "127.0.0.1")); + } } } else @@ -520,9 +516,9 @@ IceSSL::SslEndpointFactory::protocol() const } EndpointIPtr -IceSSL::SslEndpointFactory::create(const std::string& str, bool adapterEndp) const +IceSSL::SslEndpointFactory::create(const std::string& str) const { - return new SslEndpointI(_plugin, str, adapterEndp); + return new SslEndpointI(_plugin, str); } EndpointIPtr diff --git a/cpp/src/IceSSL/SslEndpointI.h b/cpp/src/IceSSL/SslEndpointI.h index 12739dee9f9..87c41b953cb 100644 --- a/cpp/src/IceSSL/SslEndpointI.h +++ b/cpp/src/IceSSL/SslEndpointI.h @@ -25,7 +25,7 @@ public: SslEndpointI(const IceSSL::OpenSSLPluginIPtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool, bool); - SslEndpointI(const IceSSL::OpenSSLPluginIPtr&, const std::string&, bool); + SslEndpointI(const IceSSL::OpenSSLPluginIPtr&, const std::string&); SslEndpointI(const IceSSL::OpenSSLPluginIPtr&, IceInternal::BasicStream*); virtual void streamWrite(IceInternal::BasicStream*) const; @@ -43,7 +43,7 @@ public: virtual IceInternal::TransceiverPtr serverTransceiver(IceInternal::EndpointIPtr&) const; virtual IceInternal::ConnectorPtr connector() const; virtual IceInternal::AcceptorPtr acceptor(IceInternal::EndpointIPtr&) const; - virtual std::vector<IceInternal::EndpointIPtr> expand() const; + virtual std::vector<IceInternal::EndpointIPtr> expand(bool) const; virtual bool publish() const; virtual bool equivalent(const IceInternal::TransceiverPtr&) const; virtual bool equivalent(const IceInternal::AcceptorPtr&) const; @@ -85,7 +85,7 @@ public: virtual Ice::Short type() const; virtual std::string protocol() const; - virtual IceInternal::EndpointIPtr create(const std::string&, bool) const; + virtual IceInternal::EndpointIPtr create(const std::string&) const; virtual IceInternal::EndpointIPtr read(IceInternal::BasicStream*) const; virtual void destroy(); diff --git a/cppe/CHANGES b/cppe/CHANGES index 7355d01c9a9..c018cc1096f 100644 --- a/cppe/CHANGES +++ b/cppe/CHANGES @@ -1,6 +1,10 @@ Changes since version 1.0.0 --------------------------- +- If a proxy is not configured with a -h paramater, Ice will now + attempt to connect using all local interfaces. The loopback interface + (127.0.0.1) will only be tried if it is the only local interface present. + - Fixed the marshalling of doubles on ARM/Linux. - Added the ability to specify other mappings for slice sequences other diff --git a/cppe/src/IceE/Endpoint.h b/cppe/src/IceE/Endpoint.h index b7200e67cfb..6f8a07638e6 100644 --- a/cppe/src/IceE/Endpoint.h +++ b/cppe/src/IceE/Endpoint.h @@ -83,12 +83,9 @@ public: // // Expand endpoint out in to separate endpoints for each local - // host if endpoint was configured with no host set. This - // only applies for ObjectAdapter endpoints. + // host if endpoint was configured with no host set. // -#ifndef ICEE_PURE_CLIENT - virtual std::vector<EndpointPtr> expand() const = 0; -#endif + virtual std::vector<EndpointPtr> expand(bool) const = 0; // // Return whether the endpoint should be published in proxies diff --git a/cppe/src/IceE/EndpointFactory.h b/cppe/src/IceE/EndpointFactory.h index 850b99b815b..e816f71ea0f 100644 --- a/cppe/src/IceE/EndpointFactory.h +++ b/cppe/src/IceE/EndpointFactory.h @@ -26,7 +26,7 @@ public: ~EndpointFactory(); - EndpointPtr create(const std::string&, bool) const; + EndpointPtr create(const std::string&) const; EndpointPtr read(BasicStream*) const; void destroy(); diff --git a/cppe/src/IceE/ObjectAdapter.cpp b/cppe/src/IceE/ObjectAdapter.cpp index bc6b5c22b98..2b7ba3a8574 100644 --- a/cppe/src/IceE/ObjectAdapter.cpp +++ b/cppe/src/IceE/ObjectAdapter.cpp @@ -910,14 +910,14 @@ Ice::ObjectAdapter::parseEndpoints(const string& str) const } string s = endpts.substr(beg, end - beg); - EndpointPtr endp = _instance->endpointFactory()->create(s, true); + EndpointPtr endp = _instance->endpointFactory()->create(s); if(endp == 0) { EndpointParseException ex(__FILE__, __LINE__); ex.str = s; throw ex; } - vector<EndpointPtr> endps = endp->expand(); + vector<EndpointPtr> endps = endp->expand(true); endpoints.insert(endpoints.end(), endps.begin(), endps.end()); ++end; diff --git a/cppe/src/IceE/ReferenceFactory.cpp b/cppe/src/IceE/ReferenceFactory.cpp index f35ae9b0528..729a3736603 100644 --- a/cppe/src/IceE/ReferenceFactory.cpp +++ b/cppe/src/IceE/ReferenceFactory.cpp @@ -11,6 +11,7 @@ #include <IceE/LocalException.h> #include <IceE/Instance.h> #include <IceE/IdentityUtil.h> +#include <IceE/Endpoint.h> #include <IceE/EndpointFactory.h> #ifdef ICEE_HAS_ROUTER # include <IceE/RouterInfo.h> @@ -461,10 +462,11 @@ IceInternal::ReferenceFactory::create(const string& str) } string es = s.substr(beg, end - beg); - EndpointPtr endp = _instance->endpointFactory()->create(es, false); + EndpointPtr endp = _instance->endpointFactory()->create(es); if(endp != 0) { - endpoints.push_back(endp); + vector<EndpointPtr> endps = endp->expand(false); + endpoints.insert(endpoints.end(), endps.begin(), endps.end()); } else { diff --git a/cppe/src/IceE/UnknownEndpoint.cpp b/cppe/src/IceE/UnknownEndpoint.cpp index 69f9c08aa55..db2d88b109f 100644 --- a/cppe/src/IceE/UnknownEndpoint.cpp +++ b/cppe/src/IceE/UnknownEndpoint.cpp @@ -79,15 +79,6 @@ IceInternal::UnknownEndpoint::acceptor(EndpointPtr& endp) const return 0; } -vector<EndpointPtr> -IceInternal::UnknownEndpoint::expand() const -{ - assert(false); - vector<EndpointPtr> ret; - return ret; - -} - bool IceInternal::UnknownEndpoint::publish() const { @@ -96,6 +87,15 @@ IceInternal::UnknownEndpoint::publish() const #endif +vector<EndpointPtr> +IceInternal::UnknownEndpoint::expand(bool includeLoopback) const +{ + assert(false); + vector<EndpointPtr> ret; + return ret; + +} + bool IceInternal::UnknownEndpoint::equivalent(const TransceiverPtr&) const { diff --git a/cppe/src/IceE/UnknownEndpoint.h b/cppe/src/IceE/UnknownEndpoint.h index bf1c5e93eb2..4f43aaf6247 100644 --- a/cppe/src/IceE/UnknownEndpoint.h +++ b/cppe/src/IceE/UnknownEndpoint.h @@ -30,9 +30,9 @@ public: virtual ConnectorPtr connector() const; #ifndef ICEE_PURE_CLIENT virtual AcceptorPtr acceptor(EndpointPtr&) const; - virtual std::vector<EndpointPtr> expand() const; virtual bool publish() const; #endif + virtual std::vector<EndpointPtr> expand(bool) const; virtual bool equivalent(const TransceiverPtr&) const; #ifndef ICEE_PURE_CLIENT virtual bool equivalent(const AcceptorPtr&) const; diff --git a/cppe/src/TcpTransport/EndpointFactory.cpp b/cppe/src/TcpTransport/EndpointFactory.cpp index 9e44b23af9f..11b09c7227e 100644 --- a/cppe/src/TcpTransport/EndpointFactory.cpp +++ b/cppe/src/TcpTransport/EndpointFactory.cpp @@ -30,7 +30,7 @@ IceInternal::EndpointFactory::~EndpointFactory() } EndpointPtr -IceInternal::EndpointFactory::create(const std::string& str, bool adapterEndp) const +IceInternal::EndpointFactory::create(const std::string& str) const { const string delim = " \t\n\r"; @@ -52,7 +52,7 @@ IceInternal::EndpointFactory::create(const std::string& str, bool adapterEndp) c if(protocol == "default" || protocol == "tcp") { - return new TcpEndpoint(_instance, str.substr(end), adapterEndp); + return new TcpEndpoint(_instance, str.substr(end)); } return 0; diff --git a/cppe/src/TcpTransport/TcpEndpoint.cpp b/cppe/src/TcpTransport/TcpEndpoint.cpp index 96f6caf1cb0..85f6ef4d556 100644 --- a/cppe/src/TcpTransport/TcpEndpoint.cpp +++ b/cppe/src/TcpTransport/TcpEndpoint.cpp @@ -33,7 +33,7 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string& { } -IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string& str, bool adapterEndp) : +IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string& str) : _instance(instance), _port(0), _timeout(-1), @@ -137,17 +137,10 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string& const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost; if(_host.empty()) { - if(adapterEndp) - { - const_cast<string&>(_host) = "0.0.0.0"; - } - else - { - const_cast<string&>(_host) = getLocalHost(true); - } + const_cast<string&>(_host) = "0.0.0.0"; } } - else if(_host == "*" && adapterEndp) + else if(_host == "*") { const_cast<string&>(_host) = "0.0.0.0"; } @@ -355,18 +348,8 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const return false; } -#ifndef ICEE_PURE_CLIENT - -AcceptorPtr -IceInternal::TcpEndpoint::acceptor(EndpointPtr& endp) const -{ - Acceptor* p = new Acceptor(_instance, _host, _port); - endp = new TcpEndpoint(_instance, _host, p->effectivePort(), _timeout, _publish); - return p; -} - vector<EndpointPtr> -IceInternal::TcpEndpoint::expand() const +IceInternal::TcpEndpoint::expand(bool includeLoopback) const { vector<EndpointPtr> endps; if(_host == "0.0.0.0") @@ -374,8 +357,11 @@ IceInternal::TcpEndpoint::expand() const vector<string> hosts = getLocalHosts(); for(unsigned int i = 0; i < hosts.size(); ++i) { - endps.push_back(new TcpEndpoint(_instance, hosts[i], _port, _timeout, - hosts.size() == 1 || hosts[i] != "127.0.0.1")); + if(includeLoopback || hosts.size() == 1 || hosts[i] != "127.0.0.1") + { + endps.push_back(new TcpEndpoint(_instance, hosts[i], _port, _timeout, + hosts.size() == 1 || hosts[i] != "127.0.0.1")); + } } } else @@ -385,6 +371,16 @@ IceInternal::TcpEndpoint::expand() const return endps; } +#ifndef ICEE_PURE_CLIENT + +AcceptorPtr +IceInternal::TcpEndpoint::acceptor(EndpointPtr& endp) const +{ + Acceptor* p = new Acceptor(_instance, _host, _port); + endp = new TcpEndpoint(_instance, _host, p->effectivePort(), _timeout, _publish); + return p; +} + bool IceInternal::TcpEndpoint::publish() const { diff --git a/cppe/src/TcpTransport/TcpEndpoint.h b/cppe/src/TcpTransport/TcpEndpoint.h index dd2760e62e4..0904855e1fe 100644 --- a/cppe/src/TcpTransport/TcpEndpoint.h +++ b/cppe/src/TcpTransport/TcpEndpoint.h @@ -22,7 +22,7 @@ class TcpEndpoint : public IceInternal::Endpoint public: TcpEndpoint(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, bool); - TcpEndpoint(const InstancePtr&, const std::string&, bool); + TcpEndpoint(const InstancePtr&, const std::string&); TcpEndpoint(BasicStream*); virtual void streamWrite(BasicStream*) const; @@ -34,9 +34,9 @@ public: virtual ConnectorPtr connector() const; #ifndef ICEE_PURE_CLIENT virtual AcceptorPtr acceptor(EndpointPtr&) const; - virtual std::vector<EndpointPtr> expand() const; virtual bool publish() const; #endif + virtual std::vector<EndpointPtr> expand(bool) const; virtual bool equivalent(const TransceiverPtr&) const; #ifndef ICEE_PURE_CLIENT virtual bool equivalent(const AcceptorPtr&) const; diff --git a/cs/CHANGES b/cs/CHANGES index e975cdeee29..c19b3914675 100644 --- a/cs/CHANGES +++ b/cs/CHANGES @@ -1,6 +1,10 @@ Changes since version 3.0.1 --------------------------- +- If a proxy is not configured with a -h paramater, Ice will now + attempt to connect using all local interfaces. The loopback interface + (127.0.0.1) will only be tried if it is the only local interface present. + - .NET 2.0 is now the target for All.sln. To build a version of Ice for C# that is compatible with .NET 1.1, use All_11.sln instead. diff --git a/cs/src/Ice/EndpointFactory.cs b/cs/src/Ice/EndpointFactory.cs index d58c218c963..3904aafe57e 100755 --- a/cs/src/Ice/EndpointFactory.cs +++ b/cs/src/Ice/EndpointFactory.cs @@ -14,7 +14,7 @@ namespace IceInternal { short type(); string protocol(); - EndpointI create(string str, bool adapterEndp); + EndpointI create(string str); EndpointI read(BasicStream s); void destroy(); } diff --git a/cs/src/Ice/EndpointFactoryManager.cs b/cs/src/Ice/EndpointFactoryManager.cs index c78349c9f7a..661083429e0 100755 --- a/cs/src/Ice/EndpointFactoryManager.cs +++ b/cs/src/Ice/EndpointFactoryManager.cs @@ -54,7 +54,7 @@ namespace IceInternal } } - public EndpointI create(string str, bool adapterEndp) + public EndpointI create(string str) { lock(this) { @@ -82,7 +82,7 @@ namespace IceInternal EndpointFactory f = (EndpointFactory)_factories[i]; if(f.protocol().Equals(protocol)) { - return f.create(s.Substring(m.Index + m.Length), adapterEndp); + return f.create(s.Substring(m.Index + m.Length)); } } diff --git a/cs/src/Ice/EndpointI.cs b/cs/src/Ice/EndpointI.cs index d41bb966bf5..983d7cb3c6b 100755 --- a/cs/src/Ice/EndpointI.cs +++ b/cs/src/Ice/EndpointI.cs @@ -120,10 +120,9 @@ namespace IceInternal // // Expand endpoint out in to separate endpoints for each local - // host if endpoint was configured with no host set. This - // only applies for ObjectAdapter endpoints. + // host if endpoint was configured with no host set. // - public abstract ArrayList expand(); + public abstract ArrayList expand(bool includeLoopback); // // Return whether the endpoint should be published in proxies diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs index 189d7c4aa14..2d563992bf7 100755 --- a/cs/src/Ice/ObjectAdapterI.cs +++ b/cs/src/Ice/ObjectAdapterI.cs @@ -1083,14 +1083,14 @@ namespace Ice } string s = endpts.Substring(beg, (end) - (beg)); - IceInternal.EndpointI endp = instance_.endpointFactoryManager().create(s, true); + IceInternal.EndpointI endp = instance_.endpointFactoryManager().create(s); if(endp == null) { Ice.EndpointParseException e2 = new Ice.EndpointParseException(); e2.str = s; throw e2; } - ArrayList endps = endp.expand(); + ArrayList endps = endp.expand(true); endpoints.AddRange(endps); ++end; diff --git a/cs/src/Ice/ReferenceFactory.cs b/cs/src/Ice/ReferenceFactory.cs index b98daeee89e..2d8a4a8d7b7 100755 --- a/cs/src/Ice/ReferenceFactory.cs +++ b/cs/src/Ice/ReferenceFactory.cs @@ -424,10 +424,11 @@ namespace IceInternal } string es = s.Substring(beg, end - beg); - EndpointI endp = instance_.endpointFactoryManager().create(es, false); + EndpointI endp = instance_.endpointFactoryManager().create(es); if(endp != null) { - endpoints.Add(endp); + ArrayList endps = endp.expand(false); + endpoints.AddRange(endps); } else { diff --git a/cs/src/Ice/TcpEndpointI.cs b/cs/src/Ice/TcpEndpointI.cs index baae747f3d1..f87a620a1e4 100755 --- a/cs/src/Ice/TcpEndpointI.cs +++ b/cs/src/Ice/TcpEndpointI.cs @@ -29,7 +29,7 @@ namespace IceInternal calcHashValue(); } - public TcpEndpointI(Instance instance, string str, bool adapterEndp) + public TcpEndpointI(Instance instance, string str) { instance_ = instance; _host = null; @@ -159,17 +159,10 @@ namespace IceInternal _host = instance_.defaultsAndOverrides().defaultHost; if(_host == null) { - if(adapterEndp) - { - _host = "0.0.0.0"; - } - else - { - _host = Network.getLocalHost(true); - } + _host = "0.0.0.0"; } } - else if(_host.Equals("*") && adapterEndp) + else if(_host.Equals("*")) { _host = "0.0.0.0"; } @@ -372,7 +365,7 @@ namespace IceInternal // only applies for ObjectAdapter endpoints. // public override ArrayList - expand() + expand(bool includeLoopback) { ArrayList endps = new ArrayList(); if(_host.Equals("0.0.0.0")) @@ -380,8 +373,11 @@ namespace IceInternal string[] hosts = Network.getLocalHosts(); for(int i = 0; i < hosts.Length; ++i) { - endps.Add(new TcpEndpointI(instance_, hosts[i], _port, _timeout, _connectionId, _compress, - hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + if(includeLoopback || hosts.Length == 1 || !hosts[i].Equals("127.0.0.1")) + { + endps.Add(new TcpEndpointI(instance_, hosts[i], _port, _timeout, _connectionId, _compress, + hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + } } } else @@ -583,9 +579,9 @@ namespace IceInternal return "tcp"; } - public EndpointI create(string str, bool adapterEndp) + public EndpointI create(string str) { - return new TcpEndpointI(instance_, str, adapterEndp); + return new TcpEndpointI(instance_, str); } public EndpointI read(BasicStream s) diff --git a/cs/src/Ice/UdpEndpointI.cs b/cs/src/Ice/UdpEndpointI.cs index 63224a5d472..bd0e145e198 100755 --- a/cs/src/Ice/UdpEndpointI.cs +++ b/cs/src/Ice/UdpEndpointI.cs @@ -33,7 +33,7 @@ namespace IceInternal calcHashValue(); } - public UdpEndpointI(Instance instance, string str, bool adapterEndp) + public UdpEndpointI(Instance instance, string str) { instance_ = instance; _host = null; @@ -269,17 +269,10 @@ namespace IceInternal _host = instance.defaultsAndOverrides().defaultHost; if(_host == null) { - if(adapterEndp) - { - _host = "0.0.0.0"; - } - else - { - _host = Network.getLocalHost(true); - } + _host = "0.0.0.0"; } } - else if(_host.Equals("*") && adapterEndp) + else if(_host.Equals("*")) { _host = "0.0.0.0"; } @@ -520,7 +513,7 @@ namespace IceInternal // only applies for ObjectAdapter endpoints. // public override ArrayList - expand() + expand(bool includeLoopback) { ArrayList endps = new ArrayList(); if(_host.Equals("0.0.0.0")) @@ -528,8 +521,11 @@ namespace IceInternal string[] hosts = Network.getLocalHosts(); for(int i = 0; i < hosts.Length; ++i) { - endps.Add(new UdpEndpointI(instance_, hosts[i], _port, _connectionId, _compress, - hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + if(includeLoopback || hosts.Length == 1 || !hosts[i].Equals("127.0.0.1")) + { + endps.Add(new UdpEndpointI(instance_, hosts[i], _port, _connectionId, _compress, + hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + } } } else @@ -771,9 +767,9 @@ namespace IceInternal return "udp"; } - public EndpointI create(string str, bool adapterEndp) + public EndpointI create(string str) { - return new UdpEndpointI(instance_, str, adapterEndp); + return new UdpEndpointI(instance_, str); } public EndpointI read(BasicStream s) diff --git a/cs/src/Ice/UnknownEndpointI.cs b/cs/src/Ice/UnknownEndpointI.cs index e835c42b2a4..5633a266e29 100755 --- a/cs/src/Ice/UnknownEndpointI.cs +++ b/cs/src/Ice/UnknownEndpointI.cs @@ -172,7 +172,7 @@ namespace IceInternal // only applies for ObjectAdapter endpoints. // public override ArrayList - expand() + expand(bool includeLoopback) { return null; } diff --git a/cs/src/IceSSL/SslEndpointI.cs b/cs/src/IceSSL/SslEndpointI.cs index 171f2979e26..12127907e2e 100755 --- a/cs/src/IceSSL/SslEndpointI.cs +++ b/cs/src/IceSSL/SslEndpointI.cs @@ -28,7 +28,7 @@ namespace IceSSL calcHashValue(); } - internal SslEndpointI(Instance instance, string str, bool adapterEndp) + internal SslEndpointI(Instance instance, string str) { instance_ = instance; host_ = null; @@ -158,17 +158,10 @@ namespace IceSSL host_ = instance_.defaultHost(); if(host_ == null) { - if(adapterEndp) - { - host_ = "0.0.0.0"; - } - else - { - host_ = IceInternal.Network.getLocalHost(true); - } + host_ = "0.0.0.0"; } } - else if(host_.Equals("*") && adapterEndp) + else if(host_.Equals("*")) { host_ = "0.0.0.0"; } @@ -370,7 +363,7 @@ namespace IceSSL // host if endpoint was configured with no host set. This // only applies for ObjectAdapter endpoints. // - public override ArrayList expand() + public override ArrayList expand(bool includeLoopback) { ArrayList endps = new ArrayList(); if(host_.Equals("0.0.0.0")) @@ -378,8 +371,11 @@ namespace IceSSL string[] hosts = IceInternal.Network.getLocalHosts(); for(int i = 0; i < hosts.Length; ++i) { - endps.Add(new SslEndpointI(instance_, hosts[i], port_, timeout_, connectionId_, compress_, - hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + if(includeLoopback || hosts.Length == 1 || !hosts[i].Equals("127.0.0.1")) + { + endps.Add(new SslEndpointI(instance_, hosts[i], port_, timeout_, connectionId_, compress_, + hosts.Length == 1 || !hosts[i].Equals("127.0.0.1"))); + } } } else @@ -580,9 +576,9 @@ namespace IceSSL return "ssl"; } - public IceInternal.EndpointI create(string str, bool adapterEndp) + public IceInternal.EndpointI create(string str) { - return new SslEndpointI(instance_, str, adapterEndp); + return new SslEndpointI(instance_, str); } public IceInternal.EndpointI read(IceInternal.BasicStream s) diff --git a/java/CHANGES b/java/CHANGES index 57c8a20a256..cc530720448 100644 --- a/java/CHANGES +++ b/java/CHANGES @@ -1,6 +1,10 @@ Changes since version 3.0.1 --------------------------- +- If a proxy is not configured with a -h paramater, Ice will now + attempt to connect using all local interfaces. The loopback interface + (127.0.0.1) will only be tried if it is the only local interface present. + - createReverseProxy() and createProxy() did not use the default context established on the communicator and created a proxy with an empty context instead. This has been fixed. diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 898f0174919..23f92ccd938 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -1052,14 +1052,14 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } String s = endpts.substring(beg, end); - IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, true); + IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s); if(endp == null) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = s; throw e; } - java.util.ArrayList endps = endp.expand(); + java.util.ArrayList endps = endp.expand(true); endpoints.addAll(endps); ++end; diff --git a/java/src/IceInternal/EndpointFactory.java b/java/src/IceInternal/EndpointFactory.java index f4797838a5f..26211045eea 100644 --- a/java/src/IceInternal/EndpointFactory.java +++ b/java/src/IceInternal/EndpointFactory.java @@ -13,7 +13,7 @@ public interface EndpointFactory { short type(); String protocol(); - EndpointI create(String str, boolean adapterEndp); + EndpointI create(String str); EndpointI read(BasicStream s); void destroy(); } diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index 9823c98d001..944405f2bb3 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -45,7 +45,7 @@ public final class EndpointFactoryManager } public synchronized EndpointI - create(String str, boolean adapterEndp) + create(String str) { String s = str.trim(); if(s.length() == 0) @@ -72,7 +72,7 @@ public final class EndpointFactoryManager EndpointFactory f = (EndpointFactory)_factories.get(i); if(f.protocol().equals(protocol)) { - return f.create(s.substring(m.end()), adapterEndp); + return f.create(s.substring(m.end())); } } diff --git a/java/src/IceInternal/EndpointI.java b/java/src/IceInternal/EndpointI.java index b73634f5684..4a59bdad075 100644 --- a/java/src/IceInternal/EndpointI.java +++ b/java/src/IceInternal/EndpointI.java @@ -118,10 +118,9 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable // // Expand endpoint out in to separate endpoints for each local - // host if endpoint was configured with no host set. This - // only applies for ObjectAdapter endpoints. + // host if endpoint was configured with no host set. // - public abstract java.util.ArrayList expand(); + public abstract java.util.ArrayList expand(boolean includeLoopback); // // Return whether endpoint should be published in proxies diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 9b6d1b0a12f..5ab02b37957 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -413,10 +413,11 @@ public final class ReferenceFactory } String es = s.substring(beg, end); - EndpointI endp = _instance.endpointFactoryManager().create(es, false); + EndpointI endp = _instance.endpointFactoryManager().create(es); if(endp != null) { - endpoints.add(endp); + java.util.ArrayList endps = endp.expand(false); + endpoints.addAll(endps); } else { diff --git a/java/src/IceInternal/TcpEndpointFactory.java b/java/src/IceInternal/TcpEndpointFactory.java index b180698b39c..2f03dbe382f 100644 --- a/java/src/IceInternal/TcpEndpointFactory.java +++ b/java/src/IceInternal/TcpEndpointFactory.java @@ -29,9 +29,9 @@ final class TcpEndpointFactory implements EndpointFactory } public EndpointI - create(String str, boolean adapterEndp) + create(String str) { - return new TcpEndpointI(_instance, str, adapterEndp); + return new TcpEndpointI(_instance, str); } public EndpointI diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index 51941c5bea8..b0399b020b4 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -27,7 +27,7 @@ final class TcpEndpointI extends EndpointI } public - TcpEndpointI(Instance instance, String str, boolean adapterEndp) + TcpEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -138,17 +138,10 @@ final class TcpEndpointI extends EndpointI _host = _instance.defaultsAndOverrides().defaultHost; if(_host == null) { - if(adapterEndp) - { - _host = "0.0.0.0"; - } - else - { - _host = Network.getLocalHost(true); - } + _host = "0.0.0.0"; } } - else if(_host.equals("*") && adapterEndp) + else if(_host.equals("*")) { _host = "0.0.0.0"; } @@ -367,7 +360,7 @@ final class TcpEndpointI extends EndpointI // only applies for ObjectAdapter endpoints. // public java.util.ArrayList - expand() + expand(boolean includeLoopback) { java.util.ArrayList endps = new java.util.ArrayList(); if(_host.equals("0.0.0.0")) @@ -377,8 +370,11 @@ final class TcpEndpointI extends EndpointI while(iter.hasNext()) { String host = (String)iter.next(); - endps.add(new TcpEndpointI(_instance, host, _port, _timeout, _connectionId, _compress, - hosts.size() == 1 || !host.equals("127.0.0.1"))); + if(includeLoopback || hosts.size() == 1 || !host.equals("127.0.0.1")) + { + endps.add(new TcpEndpointI(_instance, host, _port, _timeout, _connectionId, _compress, + hosts.size() == 1 || !host.equals("127.0.0.1"))); + } } } else diff --git a/java/src/IceInternal/UdpEndpointFactory.java b/java/src/IceInternal/UdpEndpointFactory.java index 3a4826a4b53..241dd90d29f 100644 --- a/java/src/IceInternal/UdpEndpointFactory.java +++ b/java/src/IceInternal/UdpEndpointFactory.java @@ -29,9 +29,9 @@ final class UdpEndpointFactory implements EndpointFactory } public EndpointI - create(String str, boolean adapterEndp) + create(String str) { - return new UdpEndpointI(_instance, str, adapterEndp); + return new UdpEndpointI(_instance, str); } public EndpointI diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java index 763707b9e29..48e8274ad2c 100644 --- a/java/src/IceInternal/UdpEndpointI.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -31,7 +31,7 @@ final class UdpEndpointI extends EndpointI } public - UdpEndpointI(Instance instance, String str, boolean adapterEndp) + UdpEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -234,17 +234,10 @@ final class UdpEndpointI extends EndpointI _host = instance.defaultsAndOverrides().defaultHost; if(_host == null) { - if(adapterEndp) - { - _host = "0.0.0.0"; - } - else - { - _host = Network.getLocalHost(true); - } + _host = "0.0.0.0"; } } - else if(_host.equals("*") && adapterEndp) + else if(_host.equals("*")) { _host = "0.0.0.0"; } @@ -501,7 +494,7 @@ final class UdpEndpointI extends EndpointI // only applies for ObjectAdapter endpoints. // public java.util.ArrayList - expand() + expand(boolean includeLoopback) { java.util.ArrayList endps = new java.util.ArrayList(); if(_host.equals("0.0.0.0")) @@ -511,8 +504,11 @@ final class UdpEndpointI extends EndpointI while(iter.hasNext()) { String host = (String)iter.next(); - endps.add(new UdpEndpointI(_instance, host, _port, _connectionId, _compress, - hosts.size() == 1 || !host.equals("127.0.0.1"))); + if(includeLoopback || hosts.size() == 1 || !host.equals("127.0.0.1")) + { + endps.add(new UdpEndpointI(_instance, host, _port, _connectionId, _compress, + hosts.size() == 1 || !host.equals("127.0.0.1"))); + } } } else diff --git a/java/src/IceInternal/UnknownEndpointI.java b/java/src/IceInternal/UnknownEndpointI.java index 7e4cafc099c..ff11fbfb34a 100644 --- a/java/src/IceInternal/UnknownEndpointI.java +++ b/java/src/IceInternal/UnknownEndpointI.java @@ -185,7 +185,7 @@ final class UnknownEndpointI extends EndpointI // only applies for ObjectAdapter endpoints. // public java.util.ArrayList - expand() + expand(boolean includeLoopback) { assert(false); return null; diff --git a/java/src/IceSSL/SslEndpointFactory.java b/java/src/IceSSL/SslEndpointFactory.java index 6a4d36efeb6..89c4f8072bd 100644 --- a/java/src/IceSSL/SslEndpointFactory.java +++ b/java/src/IceSSL/SslEndpointFactory.java @@ -29,9 +29,9 @@ final class SslEndpointFactory implements IceInternal.EndpointFactory } public IceInternal.EndpointI - create(String str, boolean adapterEndp) + create(String str) { - return new SslEndpointI(_instance, str, adapterEndp); + return new SslEndpointI(_instance, str); } public IceInternal.EndpointI diff --git a/java/src/IceSSL/SslEndpointI.java b/java/src/IceSSL/SslEndpointI.java index db130be2258..d10edc06f18 100644 --- a/java/src/IceSSL/SslEndpointI.java +++ b/java/src/IceSSL/SslEndpointI.java @@ -27,7 +27,7 @@ final class SslEndpointI extends IceInternal.EndpointI } public - SslEndpointI(Instance instance, String str, boolean adapterEndp) + SslEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -138,17 +138,10 @@ final class SslEndpointI extends IceInternal.EndpointI _host = _instance.defaultHost(); if(_host == null) { - if(adapterEndp) - { - _host = "0.0.0.0"; - } - else - { - _host = IceInternal.Network.getLocalHost(true); - } + _host = "0.0.0.0"; } } - else if(_host.equals("*") && adapterEndp) + else if(_host.equals("*")) { _host = "0.0.0.0"; } @@ -367,7 +360,7 @@ final class SslEndpointI extends IceInternal.EndpointI // only applies for ObjectAdapter endpoints. // public java.util.ArrayList - expand() + expand(boolean includeLoopback) { java.util.ArrayList endps = new java.util.ArrayList(); if(_host.equals("0.0.0.0")) @@ -377,8 +370,11 @@ final class SslEndpointI extends IceInternal.EndpointI while(iter.hasNext()) { String host = (String)iter.next(); - endps.add(new SslEndpointI(_instance, host, _port, _timeout, _connectionId, _compress, - hosts.size() == 1 || !host.equals("127.0.0.1"))); + if(includeLoopback || hosts.size() == 1 || !host.equals("127.0.0.1")) + { + endps.add(new SslEndpointI(_instance, host, _port, _timeout, _connectionId, _compress, + hosts.size() == 1 || !host.equals("127.0.0.1"))); + } } } else |