diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-02-13 17:53:37 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-02-13 17:53:37 +0000 |
commit | 966060d3a694438bc977ff5be79e33c77ace765a (patch) | |
tree | 78b9e96a2ac9a94e7379f9f4b5ce1c67b6a941d0 /java | |
parent | Fix (diff) | |
download | ice-966060d3a694438bc977ff5be79e33c77ace765a.tar.bz2 ice-966060d3a694438bc977ff5be79e33c77ace765a.tar.xz ice-966060d3a694438bc977ff5be79e33c77ace765a.zip |
Bug 804 - no endpoint in reference means try all local interfaces
Diffstat (limited to 'java')
-rw-r--r-- | java/CHANGES | 4 | ||||
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointFactory.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointFactoryManager.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointI.java | 5 | ||||
-rw-r--r-- | java/src/IceInternal/ReferenceFactory.java | 5 | ||||
-rw-r--r-- | java/src/IceInternal/TcpEndpointFactory.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/TcpEndpointI.java | 22 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpointFactory.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpointI.java | 22 | ||||
-rw-r--r-- | java/src/IceInternal/UnknownEndpointI.java | 2 | ||||
-rw-r--r-- | java/src/IceSSL/SslEndpointFactory.java | 4 | ||||
-rw-r--r-- | java/src/IceSSL/SslEndpointI.java | 22 |
13 files changed, 48 insertions, 56 deletions
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 |