diff options
Diffstat (limited to 'java/src/IceSSL/SslEndpointI.java')
-rw-r--r-- | java/src/IceSSL/SslEndpointI.java | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/java/src/IceSSL/SslEndpointI.java b/java/src/IceSSL/SslEndpointI.java index d865d1db123..a81cc887f02 100644 --- a/java/src/IceSSL/SslEndpointI.java +++ b/java/src/IceSSL/SslEndpointI.java @@ -14,24 +14,26 @@ final class SslEndpointI extends IceInternal.EndpointI final static short TYPE = 2; public - SslEndpointI(Instance instance, String ho, int po, int ti, boolean co) + SslEndpointI(Instance instance, String ho, int po, int ti, boolean co, boolean pub) { _instance = instance; _host = ho; _port = po; _timeout = ti; _compress = co; + _publish = pub; calcHashValue(); } public - SslEndpointI(Instance instance, String str) + SslEndpointI(Instance instance, String str, boolean adapterEndp) { _instance = instance; _host = null; _port = 0; _timeout = -1; _compress = false; + _publish = true; String[] arr = str.split("[ \t\n\r]+"); @@ -144,6 +146,17 @@ final class SslEndpointI extends IceInternal.EndpointI if(_host == null) { _host = _instance.defaultHost(); + if(_host == null) + { + if(adapterEndp) + { + _host = "0.0.0.0"; + } + else + { + _host = IceInternal.Network.getLocalHost(true); + } + } } calcHashValue(); @@ -159,6 +172,7 @@ final class SslEndpointI extends IceInternal.EndpointI _timeout = s.readInt(); _compress = s.readBool(); s.endReadEncaps(); + _publish = true; calcHashValue(); } @@ -228,7 +242,7 @@ final class SslEndpointI extends IceInternal.EndpointI } else { - return new SslEndpointI(_instance, _host, _port, timeout, _compress); + return new SslEndpointI(_instance, _host, _port, timeout, _compress, _publish); } } @@ -256,7 +270,7 @@ final class SslEndpointI extends IceInternal.EndpointI } else { - return new SslEndpointI(_instance, _host, _port, _timeout, compress); + return new SslEndpointI(_instance, _host, _port, _timeout, compress, _publish); } } @@ -332,11 +346,48 @@ final class SslEndpointI extends IceInternal.EndpointI acceptor(IceInternal.EndpointIHolder endpoint) { SslAcceptor p = new SslAcceptor(_instance, _host, _port); - endpoint.value = new SslEndpointI(_instance, _host, p.effectivePort(), _timeout, _compress); + endpoint.value = new SslEndpointI(_instance, _host, p.effectivePort(), _timeout, _compress, _publish); return p; } // + // 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. + // + public java.util.ArrayList + expand() + { + java.util.ArrayList endps = new java.util.ArrayList(); + if(_host.equals("0.0.0.0")) + { + java.util.ArrayList hosts = IceInternal.Network.getLocalHosts(); + java.util.Iterator iter = hosts.iterator(); + while(iter.hasNext()) + { + String host = (String)iter.next(); + endps.add(new SslEndpointI(_instance, host, _port, _timeout, _compress, + hosts.size() == 1 || !host.equals("127.0.0.1"))); + } + } + else + { + endps.add(this); + } + return endps; + } + + // + // Return whether endpoint should be published in proxies + // created by Object Adapter. + // + public boolean + publish() + { + return _publish; + } + + // // Check whether the endpoint is equivalent to a specific // Transceiver or Acceptor // @@ -489,5 +540,6 @@ final class SslEndpointI extends IceInternal.EndpointI private int _port; private int _timeout; private boolean _compress; + private boolean _publish; private int _hashCode; } |