diff --git a/src/org/ice4j/StackProperties.java b/src/org/ice4j/StackProperties.java index 14060ef..7c43153 100644 --- a/src/org/ice4j/StackProperties.java +++ b/src/org/ice4j/StackProperties.java @@ -125,6 +125,11 @@ public class StackProperties public static final String NOMINATION_TIMER = "org.ice4j.NOMINATION_TIMER"; + /** + * The name of the property used to disabled IPv6 support. + */ + public static final String ENABLE_IPv6 = "org.ice4j.ipv6.DISABLED"; + /** * Returns the String value of the specified property (minus all * encompassing whitespaces)and null in case no property value was mapped @@ -190,4 +195,34 @@ public class StackProperties } return intValue; } + + /** + * Gets the value of a specific property as a boolean. If the specified + * property name is associated with a value in this + * ConfigurationService, the string representation of the value + * is parsed into a boolean according to the rules of + * {@link Boolean#parseBoolean(String)} . Otherwise, + * defaultValue is returned. + * + * @param propertyName + * the name of the property to get the value of as a boolean + * @param defaultValue + * the value to be returned if the specified property name is not + * associated with a value in this + * ConfigurationService + * @return the value of the property with the specified name in this + * ConfigurationService as a boolean; + * defaultValue if the property with the specified name + * is not associated with a value in this + * ConfigurationService + */ + public static boolean getBoolean(String propertyName, boolean defaultValue) + { + String stringValue = getString(propertyName); + + return (stringValue == null) + ? defaultValue + : Boolean.parseBoolean(stringValue); + } + } diff --git a/src/org/ice4j/ice/Candidate.java b/src/org/ice4j/ice/Candidate.java index c4dd938..582173f 100644 --- a/src/org/ice4j/ice/Candidate.java +++ b/src/org/ice4j/ice/Candidate.java @@ -686,7 +686,7 @@ public abstract class Candidate @Override public String toString() { - StringBuilder buff = new StringBuilder("candidate: "); + StringBuilder buff = new StringBuilder("candidate:"); buff.append(getFoundation()); buff.append(" ").append(getParentComponent().getComponentID()); diff --git a/src/org/ice4j/ice/ConnectivityCheckClient.java b/src/org/ice4j/ice/ConnectivityCheckClient.java index 427cd76..778b79f 100644 --- a/src/org/ice4j/ice/ConnectivityCheckClient.java +++ b/src/org/ice4j/ice/ConnectivityCheckClient.java @@ -850,11 +850,14 @@ class ConnectivityCheckClient } else { - logger.fine("Received an unrecoverable error response for pair " - + pair.toShortString() + - " will mark the pair as FAILED."); - logger.info("Error response for pair: " + pair.toShortString() + - ", failing."); + int code = cl * 100 + co; + logger.fine( + "Received an unrecoverable error response (code = " + code + + ") for pair " + pair.toShortString() + + " will mark the pair as FAILED."); + logger.info( + "Error response for pair: " + pair.toShortString() + + ", failing. Code = " + code); pair.setStateFailed(); } } diff --git a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java index 15df60e..8153fce 100644 --- a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java +++ b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java @@ -67,6 +67,10 @@ public class HostCandidateHarvester Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); + boolean isIPv6Disabled = StackProperties.getBoolean( + "org.ice4j.ipv6.DISABLED", + false); + if(transport != Transport.UDP && transport != Transport.TCP) { throw new IllegalArgumentException( @@ -91,60 +95,68 @@ public class HostCandidateHarvester { InetAddress addr = addresses.nextElement(); - IceSocketWrapper sock = null; - try + if((addr instanceof Inet4Address) || !isIPv6Disabled) { - if(transport == Transport.UDP) + IceSocketWrapper sock = null; + try { - sock = createDatagramSocket( - addr, preferredPort, minPort, maxPort); - boundAtLeastOneSocket = true; + if(transport == Transport.UDP) + { + sock = createDatagramSocket( + addr, preferredPort, minPort, maxPort); + boundAtLeastOneSocket = true; + } + else if(transport == Transport.TCP) + { + if(addr instanceof Inet6Address) + continue; + sock = createServerSocket( + addr, + preferredPort, + minPort, + maxPort, + component); + boundAtLeastOneSocket = true; + } } - else if(transport == Transport.TCP) + catch(IOException exc) { - if(addr instanceof Inet6Address) - continue; - sock = createServerSocket(addr, preferredPort, minPort, - maxPort, component); - boundAtLeastOneSocket = true; + // There seems to be a problem with this particular + // address let's just move on for now and hope we will + // find better + if (logger.isLoggable(Level.WARNING)) + { + logger.warning( + "Failed to create a socket for:" + +"\naddr:" + addr + +"\npreferredPort:" + preferredPort + +"\nminPort:" + minPort + +"\nmaxPort:" + maxPort + +"\nprotocol:" + transport + +"\nContinuing with next address"); + } + continue; } - } - catch(IOException exc) - { - //there seems to be a problem with this particular address - //let's just move on for now and hope we will find better - if (logger.isLoggable(Level.WARNING)) + + HostCandidate candidate + = new HostCandidate(sock, component, transport); + candidate.setVirtual( + NetworkUtils.isInterfaceVirtual(iface)); + component.addLocalCandidate(candidate); + + if(transport == Transport.TCP) { - logger.warning( - "Failed to create a socket for:" - +"\naddr:" + addr - +"\npreferredPort:" + preferredPort - +"\nminPort:" + minPort - +"\nmaxPort:" + maxPort - +"\nprotocol:" + transport - +"\nContinuing with next address"); + // have to wait a client connection to add a STUN socket + // to the StunStack + continue; } - continue; + + // We are most certainly going to use all local host + // candidates for sending and receiving STUN connectivity + // checks. In case we have enabled STUN, we are going to use + // them as well while harvesting reflexive candidates. + createAndRegisterStunSocket(candidate); } - - HostCandidate candidate = new HostCandidate(sock, component, - transport); - candidate.setVirtual(NetworkUtils.isInterfaceVirtual(iface)); - component.addLocalCandidate(candidate); - - if(transport == Transport.TCP) - { - /* have to wait a client connection to add a STUN socket - * to the StunStack - */ - continue; - } - - //We are most certainly going to use all local host candidates - //for sending and receiving STUN connectivity checks. In case - //we have enabled STUN, we are going to use them as well while - //harvesting reflexive candidates. - createAndRegisterStunSocket(candidate); } } diff --git a/src/org/ice4j/socket/MultiplexingDatagramSocket.java b/src/org/ice4j/socket/MultiplexingDatagramSocket.java index 8a66673..3bd2fda 100644 --- a/src/org/ice4j/socket/MultiplexingDatagramSocket.java +++ b/src/org/ice4j/socket/MultiplexingDatagramSocket.java @@ -439,7 +439,7 @@ public class MultiplexingDatagramSocket synchronized (receiveSyncRoot) { inReceive = false; - receiveSyncRoot.notifyAll(); + receiveSyncRoot.notify(); } } } diff --git a/src/org/ice4j/socket/MultiplexingSocket.java b/src/org/ice4j/socket/MultiplexingSocket.java index 4ca9db9..08da536 100644 --- a/src/org/ice4j/socket/MultiplexingSocket.java +++ b/src/org/ice4j/socket/MultiplexingSocket.java @@ -379,7 +379,7 @@ public class MultiplexingSocket synchronized (receiveSyncRoot) { inReceive = false; - receiveSyncRoot.notifyAll(); + receiveSyncRoot.notify(); } } }