diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-06-04 15:53:35 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-06-04 15:53:35 +0000 |
commit | 512d5d6ee8737edc9dbc82773532ae9a54a7cfcd (patch) | |
tree | af479386298a1914edec879859341e507d0e7326 /cpp/src/IceSSL/EndpointI.cpp | |
parent | Bug 1597. (diff) | |
download | ice-512d5d6ee8737edc9dbc82773532ae9a54a7cfcd.tar.bz2 ice-512d5d6ee8737edc9dbc82773532ae9a54a7cfcd.tar.xz ice-512d5d6ee8737edc9dbc82773532ae9a54a7cfcd.zip |
Bug 1658 - listen on 0.0.0.0 rather than expanding endpoints
Diffstat (limited to 'cpp/src/IceSSL/EndpointI.cpp')
-rw-r--r-- | cpp/src/IceSSL/EndpointI.cpp | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index 9e95dd5aa1e..c057910370c 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -22,23 +22,23 @@ using namespace Ice; using namespace IceSSL; IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, const string& conId, - bool co, bool pub) : + bool co, bool oae) : _instance(instance), _host(ho), _port(po), _timeout(ti), _connectionId(conId), _compress(co), - _publish(pub) + _oaEndpoint(oae) { } -IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str) : +IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : _instance(instance), _port(0), _timeout(-1), _compress(false), - _publish(true) + _oaEndpoint(oaEndpoint) { const string delim = " \t\n\r"; @@ -138,6 +138,26 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str) : } } } + + if(_host.empty()) + { + const_cast<string&>(_host) = _instance->defaultHost(); + if(_host.empty()) + { + if(_oaEndpoint) + { + const_cast<string&>(_host) = "0.0.0.0"; + } + else + { + const_cast<string&>(_host) = "127.0.0.1"; + } + } + } + else if(_host == "*") + { + const_cast<string&>(_host) = "0.0.0.0"; + } } IceSSL::EndpointI::EndpointI(const InstancePtr& instance, IceInternal::BasicStream* s) : @@ -145,7 +165,7 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, IceInternal::BasicStre _port(0), _timeout(-1), _compress(false), - _publish(true) + _oaEndpoint(false) { s->startReadEncaps(); s->read(const_cast<string&>(_host), false); @@ -211,7 +231,7 @@ IceSSL::EndpointI::timeout(Int timeout) const } else { - return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _publish); + return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _oaEndpoint); } } @@ -224,7 +244,7 @@ IceSSL::EndpointI::connectionId(const string& connectionId) const } else { - return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _publish); + return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _oaEndpoint); } } @@ -243,7 +263,7 @@ IceSSL::EndpointI::compress(bool compress) const } else { - return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _publish); + return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _oaEndpoint); } } @@ -295,41 +315,24 @@ IceInternal::AcceptorPtr IceSSL::EndpointI::acceptor(IceInternal::EndpointIPtr& endp, const string& adapterName) const { AcceptorI* p = new AcceptorI(_instance, adapterName, _host, _port); - endp = new EndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress, _publish); + endp = new EndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress, _oaEndpoint); return p; } vector<IceInternal::EndpointIPtr> -IceSSL::EndpointI::expand(bool server) const +IceSSL::EndpointI::expand() const { - if(_host.empty()) - { - const_cast<string&>(_host) = _instance->defaultHost(); - if(_host.empty()) - { - if(server) - { - const_cast<string&>(_host) = "0.0.0.0"; - } - else - { - const_cast<string&>(_host) = "127.0.0.1"; - } - } - } - else if(_host == "*") - { - const_cast<string&>(_host) = "0.0.0.0"; - } - vector<IceInternal::EndpointIPtr> endps; if(_host == "0.0.0.0") { vector<string> hosts = IceInternal::getLocalHosts(); for(unsigned int i = 0; i < hosts.size(); ++i) { - endps.push_back(new EndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress, - hosts.size() == 1 || hosts[i] != "127.0.0.1")); + if(!_oaEndpoint || hosts.size() == 1 || hosts[i] != "127.0.0.1") + { + endps.push_back(new EndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress, + _oaEndpoint)); + } } } else @@ -340,12 +343,6 @@ IceSSL::EndpointI::expand(bool server) const } bool -IceSSL::EndpointI::publish() const -{ - return _publish; -} - -bool IceSSL::EndpointI::equivalent(const IceInternal::TransceiverPtr&) const { return false; @@ -533,9 +530,9 @@ IceSSL::EndpointFactoryI::protocol() const } IceInternal::EndpointIPtr -IceSSL::EndpointFactoryI::create(const string& str) const +IceSSL::EndpointFactoryI::create(const string& str, bool oaEndpoint) const { - return new EndpointI(_instance, str); + return new EndpointI(_instance, str, oaEndpoint); } IceInternal::EndpointIPtr |