diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-08-14 07:19:13 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-08-14 07:19:13 +0200 |
commit | b0f0bc95d4db337fa4250dd8c320d921908f55a2 (patch) | |
tree | 477644c3b5b3822f4d12a5a269406d2928aebf2e | |
parent | Another minor fix for Expect.py script (diff) | |
download | ice-b0f0bc95d4db337fa4250dd8c320d921908f55a2.tar.bz2 ice-b0f0bc95d4db337fa4250dd8c320d921908f55a2.tar.xz ice-b0f0bc95d4db337fa4250dd8c320d921908f55a2.zip |
Revert "Fixed ICE-6707 - default interface for discovery is now Ice.Default.Host if it is set"
This reverts commit 406e393f2be3a29830a7758e58e4e674afc5e21e.
-rw-r--r-- | CHANGELOG-3.6.md | 2 | ||||
-rw-r--r-- | cpp/src/IceDiscovery/PluginI.cpp | 23 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 23 | ||||
-rw-r--r-- | cpp/src/IceLocatorDiscovery/PluginI.cpp | 23 | ||||
-rwxr-xr-x | cpp/test/IceDiscovery/simple/run.py | 4 | ||||
-rw-r--r-- | cpp/test/IceGrid/simple/AllTests.cpp | 6 | ||||
-rwxr-xr-x | csharp/allTests.py | 1 | ||||
-rw-r--r-- | csharp/src/IceDiscovery/PluginI.cs | 22 | ||||
-rw-r--r-- | csharp/src/IceLocatorDiscovery/PluginI.cs | 22 | ||||
-rwxr-xr-x | csharp/test/IceDiscovery/simple/run.py | 3 | ||||
-rw-r--r-- | csharp/test/IceGrid/simple/AllTests.cs | 13 | ||||
-rw-r--r-- | java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java | 22 | ||||
-rw-r--r-- | java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java | 22 | ||||
-rwxr-xr-x | java/test/src/main/java/test/IceDiscovery/simple/run.py | 4 | ||||
-rw-r--r-- | java/test/src/main/java/test/IceGrid/simple/AllTests.java | 13 |
15 files changed, 36 insertions, 167 deletions
diff --git a/CHANGELOG-3.6.md b/CHANGELOG-3.6.md index 292934df5ba..c696ce82ce1 100644 --- a/CHANGELOG-3.6.md +++ b/CHANGELOG-3.6.md @@ -21,8 +21,6 @@ These are the changes since Ice 3.6.0. ## General Changes -- If the IceDiscovery.Interface or the IceLocatorDiscovery.Interface property is not set, the Ice.Default.Host property is now used to figure out the default interface to receive and send multicast datagrams with the IceDiscovery or IceLocatorDiscovery plug-ins. If no default host is set, the default interface for multicast is selected by the operation system. - - Connections and transports buffers are now released when the connection is closed rather than waiting for the collection or destruction of the Ice connection object. - Calling `destroy()` on the `Glacier2::SessionHelper` during connection establishment will now immediately cause the termination of the connection attempt and `SessionCallback::connectFailed()` will be called with a `CommunicatorDestroyedException`. Previously, the helper would wait until the connection attempt either succeeded or failed before calling `SessionCallback::disconnected()` or `SessionCallback::connectFailed`. diff --git a/cpp/src/IceDiscovery/PluginI.cpp b/cpp/src/IceDiscovery/PluginI.cpp index cbc9a22c5f0..e0e1a7f9849 100644 --- a/cpp/src/IceDiscovery/PluginI.cpp +++ b/cpp/src/IceDiscovery/PluginI.cpp @@ -14,8 +14,6 @@ #include <IceDiscovery/LocatorI.h> #include <IceDiscovery/LookupI.h> -#include <Ice/Network.h> - using namespace std; using namespace IceDiscovery; @@ -74,27 +72,6 @@ PluginI::initialize() } int port = properties->getPropertyAsIntWithDefault("IceDiscovery.Port", 4061); string interface = properties->getProperty("IceDiscovery.Interface"); - string defaultHost = properties->getProperty("Ice.Default.Host"); - if(interface.empty() && !defaultHost.empty()) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - IceInternal::ProtocolSupport protocol = ipv4 && !preferIPv6 ? IceInternal::EnableIPv4 : IceInternal::EnableIPv6; - try - { - IceInternal::Address address = IceInternal::getAddressForServer(defaultHost, 0, protocol, preferIPv6); - if(IceInternal::isAddressValid(address)) - { - interface = IceInternal::inetAddrToString(address); - } - } - catch(const Ice::LocalException&) - { - // Ignore - } - } if(properties->getProperty("IceDiscovery.Multicast.Endpoints").empty()) { diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index ac126a43dd8..d8a406931f4 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -11,6 +11,7 @@ #include <IceUtil/FileUtil.h> #include <Ice/Ice.h> #include <Ice/Network.h> +#include <Ice/ProtocolPluginFacade.h> // Just to get the hostname #include <IceStorm/Service.h> #include <IceSSL/IceSSL.h> @@ -591,28 +592,6 @@ RegistryI::startImpl() } int port = properties->getPropertyAsIntWithDefault("IceGrid.Registry.Discovery.Port", 4061); string interface = properties->getProperty("IceGrid.Registry.Discovery.Interface"); - string defaultHost = properties->getProperty("Ice.Default.Host"); - if(interface.empty() && !defaultHost.empty()) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - IceInternal::ProtocolSupport protocol = ipv4 && !preferIPv6 ? IceInternal::EnableIPv4 : IceInternal::EnableIPv6; - try - { - IceInternal::Address address = IceInternal::getAddressForServer(defaultHost, 0, protocol, preferIPv6); - if(IceInternal::isAddressValid(address)) - { - interface = IceInternal::inetAddrToString(address); - } - } - catch(const Ice::LocalException&) - { - // Ignore - } - } - if(properties->getProperty("IceGrid.Registry.Discovery.Endpoints").empty()) { ostringstream os; diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp index 65844d39c3f..bf30aa4cf8e 100644 --- a/cpp/src/IceLocatorDiscovery/PluginI.cpp +++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp @@ -13,8 +13,6 @@ #include <IceLocatorDiscovery/PluginI.h> #include <IceLocatorDiscovery/IceLocatorDiscovery.h> -#include <Ice/Network.h> - using namespace std; using namespace IceLocatorDiscovery; @@ -204,27 +202,6 @@ PluginI::initialize() } int port = properties->getPropertyAsIntWithDefault("IceLocatorDiscovery.Port", 4061); string intf = properties->getProperty("IceLocatorDiscovery.Interface"); - string defaultHost = properties->getProperty("Ice.Default.Host"); - if(intf.empty() && !defaultHost.empty()) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - IceInternal::ProtocolSupport protocol = ipv4 && !preferIPv6 ? IceInternal::EnableIPv4 : IceInternal::EnableIPv6; - try - { - IceInternal::Address address = IceInternal::getAddressForServer(defaultHost, 0, protocol, preferIPv6); - if(IceInternal::isAddressValid(address)) - { - intf = IceInternal::inetAddrToString(address); - } - } - catch(const Ice::LocalException&) - { - // Ignore - } - } if(properties->getProperty("IceLocatorDiscovery.Reply.Endpoints").empty()) { diff --git a/cpp/test/IceDiscovery/simple/run.py b/cpp/test/IceDiscovery/simple/run.py index e48dd655664..5de3fedd862 100755 --- a/cpp/test/IceDiscovery/simple/run.py +++ b/cpp/test/IceDiscovery/simple/run.py @@ -27,6 +27,10 @@ num = 3 args = " --IceDiscovery.Timeout=50" args += " --IceDiscovery.RetryCount=5" +if not TestUtil.ipv6: + args += " --IceDiscovery.Interface=127.0.0.1" +elif TestUtil.isDarwin(): + args += " --IceDiscovery.Interface=\"::1\"" # Set the plugin property only for the server, the client uses Ice::registerIceDiscovery() serverArgs = " --Ice.Plugin.IceDiscovery=IceDiscovery:createIceDiscovery" + args diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp index c51673118e5..e2cd0bb95f9 100644 --- a/cpp/test/IceGrid/simple/AllTests.cpp +++ b/cpp/test/IceGrid/simple/AllTests.cpp @@ -67,6 +67,12 @@ allTests(const Ice::CommunicatorPtr& communicator) initData.properties = communicator->getProperties()->clone(); initData.properties->setProperty("Ice.Default.Locator", ""); initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); +#ifdef __APPLE__ + if(initData.properties->getPropertyAsInt("Ice.PreferIPv6Address") > 0) + { + initData.properties->setProperty("IceLocatorDiscovery.Interface", "::1"); + } +#endif initData.properties->setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties->setProperty("AdapterForDiscoveryTest.Endpoints", "default"); diff --git a/csharp/allTests.py b/csharp/allTests.py index 2e5329b6403..2e5b846b4bb 100755 --- a/csharp/allTests.py +++ b/csharp/allTests.py @@ -73,7 +73,6 @@ tests = [ ("IceBox/configuration", ["core", "noipv6", "nomx"]), ("Glacier2/router", ["service"]), ("Glacier2/sessionHelper", ["core"]), - ("IceDiscovery/simple", ["service"]), ("IceGrid/simple", ["service"]), ("IceSSL/configuration", ["once", "novista", "nomono", "nocompact"]), ] diff --git a/csharp/src/IceDiscovery/PluginI.cs b/csharp/src/IceDiscovery/PluginI.cs index 0c09c4884a7..69e3a6c0667 100644 --- a/csharp/src/IceDiscovery/PluginI.cs +++ b/csharp/src/IceDiscovery/PluginI.cs @@ -12,7 +12,6 @@ namespace IceDiscovery using System; using System.Text; using System.Collections.Generic; - using System.Net; public sealed class PluginFactory : Ice.PluginFactory { @@ -48,27 +47,6 @@ namespace IceDiscovery } int port = properties.getPropertyAsIntWithDefault("IceDiscovery.Port", 4061); string intf = properties.getProperty("IceDiscovery.Interface"); - string defaultHost = properties.getProperty("Ice.Default.Host"); - if(intf.Length == 0 && defaultHost.Length > 0) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - int protocol = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6; - try - { - EndPoint addr = IceInternal.Network.getAddressForServer(defaultHost, 0, protocol, preferIPv6); - if(addr != null) - { - intf = IceInternal.Network.endpointAddressToString(addr); - } - } - catch(Ice.LocalException) - { - // Ignore - } - } if(properties.getProperty("IceDiscovery.Multicast.Endpoints").Length == 0) { diff --git a/csharp/src/IceLocatorDiscovery/PluginI.cs b/csharp/src/IceLocatorDiscovery/PluginI.cs index 3c9f9b3628f..ccf9b266850 100644 --- a/csharp/src/IceLocatorDiscovery/PluginI.cs +++ b/csharp/src/IceLocatorDiscovery/PluginI.cs @@ -13,7 +13,6 @@ namespace IceLocatorDiscovery using System.Collections.Generic; using System.Diagnostics; using System.Text; - using System.Net; public sealed class PluginFactory : Ice.PluginFactory { @@ -374,27 +373,6 @@ namespace IceLocatorDiscovery } int port = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Port", 4061); string intf = properties.getProperty("IceLocatorDiscovery.Interface"); - string defaultHost = properties.getProperty("Ice.Default.Host"); - if(intf.Length == 0 && defaultHost.Length > 0) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - int protocol = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6; - try - { - EndPoint addr = IceInternal.Network.getAddressForServer(defaultHost, 0, protocol, preferIPv6); - if(addr != null) - { - intf = IceInternal.Network.endpointAddressToString(addr); - } - } - catch(Ice.LocalException) - { - // Ignore - } - } if(properties.getProperty("IceLocatorDiscovery.Reply.Endpoints").Length == 0) { diff --git a/csharp/test/IceDiscovery/simple/run.py b/csharp/test/IceDiscovery/simple/run.py index fdb42d64382..a8e7fe8242e 100755 --- a/csharp/test/IceDiscovery/simple/run.py +++ b/csharp/test/IceDiscovery/simple/run.py @@ -33,6 +33,9 @@ if TestUtil.isDarwin() and TestUtil.ipv6: print("test not supported on OS X with IPv6") sys.exit(0) +if not TestUtil.ipv6: + args += " --IceDiscovery.Interface=127.0.0.1" + serverProc = [] for i in range(0, num): sys.stdout.write("starting server #%d... " % (i + 1)) diff --git a/csharp/test/IceGrid/simple/AllTests.cs b/csharp/test/IceGrid/simple/AllTests.cs index 40d826e5cab..96af8c4bdb3 100644 --- a/csharp/test/IceGrid/simple/AllTests.cs +++ b/csharp/test/IceGrid/simple/AllTests.cs @@ -63,7 +63,7 @@ public class AllTests IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -82,11 +82,16 @@ public class AllTests Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory"); + if(IceInternal.AssemblyUtil.osx_ && + initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) + { + initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); + } initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default"); - + Ice.Communicator com = Ice.Util.initialize(initData); test(com.getDefaultLocator() != null); com.stringToProxy("test @ TestAdapter").ice_ping(); @@ -104,7 +109,7 @@ public class AllTests // // Now, ensure that the IceGrid discovery locator correctly // handles failure to find a locator. - // + // initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown"); initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100"); diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java b/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java index ced6033e0d9..0afc4d7f915 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java +++ b/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java @@ -36,28 +36,6 @@ public class PluginI implements Ice.Plugin } int port = properties.getPropertyAsIntWithDefault("IceDiscovery.Port", 4061); String intf = properties.getProperty("IceDiscovery.Interface"); - String defaultHost = properties.getProperty("Ice.Default.Host"); - if(intf.isEmpty() && !defaultHost.isEmpty()) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - int protocol = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6; - try - { - java.net.InetSocketAddress addr = IceInternal.Network.getAddressForServer(defaultHost, 0, protocol, - preferIPv6); - if(addr != null) - { - intf = addr.getAddress().getHostAddress(); - } - } - catch(Ice.LocalException ex) - { - // Ignore - } - } if(properties.getProperty("IceDiscovery.Multicast.Endpoints").isEmpty()) { diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java index 080329ab6fa..b19bc6d59f8 100644 --- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java +++ b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java @@ -377,28 +377,6 @@ class PluginI implements Ice.Plugin } int port = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Port", 4061); String intf = properties.getProperty("IceLocatorDiscovery.Interface"); - String defaultHost = properties.getProperty("Ice.Default.Host"); - if(intf.isEmpty() && !defaultHost.isEmpty()) - { - // - // Make sure the interface is an IP address, the UDP --interface option - // doesn't support DNS names. - // - int protocol = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6; - try - { - java.net.InetSocketAddress addr = IceInternal.Network.getAddressForServer(defaultHost, 0, protocol, - preferIPv6); - if(addr != null) - { - intf = addr.getAddress().getHostAddress(); - } - } - catch(Ice.LocalException ex) - { - // Ignore - } - } if(properties.getProperty("IceLocatorDiscovery.Reply.Endpoints").isEmpty()) { diff --git a/java/test/src/main/java/test/IceDiscovery/simple/run.py b/java/test/src/main/java/test/IceDiscovery/simple/run.py index 8ab14420ca7..606a3594bcd 100755 --- a/java/test/src/main/java/test/IceDiscovery/simple/run.py +++ b/java/test/src/main/java/test/IceDiscovery/simple/run.py @@ -29,6 +29,10 @@ num = 3 args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory" args += " --IceDiscovery.Timeout=50" args += " --IceDiscovery.RetryCount=5" +if not TestUtil.ipv6: + args += " --IceDiscovery.Interface=127.0.0.1" +elif TestUtil.isDarwin(): + args += " --IceDiscovery.Interface=\"::1\"" serverProc = [] for i in range(0, num): diff --git a/java/test/src/main/java/test/IceGrid/simple/AllTests.java b/java/test/src/main/java/test/IceGrid/simple/AllTests.java index 4502b87e6e1..715abad74e1 100644 --- a/java/test/src/main/java/test/IceGrid/simple/AllTests.java +++ b/java/test/src/main/java/test/IceGrid/simple/AllTests.java @@ -70,7 +70,7 @@ public class AllTests IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -89,11 +89,16 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory"); + if(System.getProperty("os.name").contains("OS X") && + initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) + { + initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); + } initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default"); - + Ice.Communicator com = Ice.Util.initialize(initData); test(com.getDefaultLocator() != null); com.stringToProxy("test @ TestAdapter").ice_ping(); @@ -111,7 +116,7 @@ public class AllTests // // Now, ensure that the IceGrid discovery locator correctly // handles failure to find a locator. - // + // initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown"); initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100"); |