Applies patch 1, 2, 3, 4 and 7 from Daniel Pocock: [jitsi-dev] refreshing patches.

This commit is contained in:
chenzo 2012-07-06 15:39:46 +00:00
parent 891392e18a
commit 25574cea72
6 changed files with 104 additions and 54 deletions

View File

@ -125,6 +125,11 @@ public class StackProperties
public static final String NOMINATION_TIMER public static final String NOMINATION_TIMER
= "org.ice4j.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 * Returns the String value of the specified property (minus all
* encompassing whitespaces)and null in case no property value was mapped * encompassing whitespaces)and null in case no property value was mapped
@ -190,4 +195,34 @@ public class StackProperties
} }
return intValue; return intValue;
} }
/**
* Gets the value of a specific property as a boolean. If the specified
* property name is associated with a value in this
* <code>ConfigurationService</code>, the string representation of the value
* is parsed into a boolean according to the rules of
* {@link Boolean#parseBoolean(String)} . Otherwise,
* <code>defaultValue</code> 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
* <code>ConfigurationService</code>
* @return the value of the property with the specified name in this
* <code>ConfigurationService</code> as a boolean;
* <code>defaultValue</code> if the property with the specified name
* is not associated with a value in this
* <code>ConfigurationService</code>
*/
public static boolean getBoolean(String propertyName, boolean defaultValue)
{
String stringValue = getString(propertyName);
return (stringValue == null)
? defaultValue
: Boolean.parseBoolean(stringValue);
}
} }

View File

@ -686,7 +686,7 @@ public abstract class Candidate
@Override @Override
public String toString() public String toString()
{ {
StringBuilder buff = new StringBuilder("candidate: "); StringBuilder buff = new StringBuilder("candidate:");
buff.append(getFoundation()); buff.append(getFoundation());
buff.append(" ").append(getParentComponent().getComponentID()); buff.append(" ").append(getParentComponent().getComponentID());

View File

@ -850,11 +850,14 @@ class ConnectivityCheckClient
} }
else else
{ {
logger.fine("Received an unrecoverable error response for pair " int code = cl * 100 + co;
+ pair.toShortString() + logger.fine(
" will mark the pair as FAILED."); "Received an unrecoverable error response (code = " + code
logger.info("Error response for pair: " + pair.toShortString() + + ") for pair " + pair.toShortString() +
", failing."); " will mark the pair as FAILED.");
logger.info(
"Error response for pair: " + pair.toShortString() +
", failing. Code = " + code);
pair.setStateFailed(); pair.setStateFailed();
} }
} }

View File

@ -67,6 +67,10 @@ public class HostCandidateHarvester
Enumeration<NetworkInterface> interfaces Enumeration<NetworkInterface> interfaces
= NetworkInterface.getNetworkInterfaces(); = NetworkInterface.getNetworkInterfaces();
boolean isIPv6Disabled = StackProperties.getBoolean(
"org.ice4j.ipv6.DISABLED",
false);
if(transport != Transport.UDP && transport != Transport.TCP) if(transport != Transport.UDP && transport != Transport.TCP)
{ {
throw new IllegalArgumentException( throw new IllegalArgumentException(
@ -91,60 +95,68 @@ public class HostCandidateHarvester
{ {
InetAddress addr = addresses.nextElement(); InetAddress addr = addresses.nextElement();
IceSocketWrapper sock = null; if((addr instanceof Inet4Address) || !isIPv6Disabled)
try
{ {
if(transport == Transport.UDP) IceSocketWrapper sock = null;
try
{ {
sock = createDatagramSocket( if(transport == Transport.UDP)
addr, preferredPort, minPort, maxPort); {
boundAtLeastOneSocket = true; 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) // There seems to be a problem with this particular
continue; // address let's just move on for now and hope we will
sock = createServerSocket(addr, preferredPort, minPort, // find better
maxPort, component); if (logger.isLoggable(Level.WARNING))
boundAtLeastOneSocket = true; {
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) HostCandidate candidate
{ = new HostCandidate(sock, component, transport);
//there seems to be a problem with this particular address candidate.setVirtual(
//let's just move on for now and hope we will find better NetworkUtils.isInterfaceVirtual(iface));
if (logger.isLoggable(Level.WARNING)) component.addLocalCandidate(candidate);
if(transport == Transport.TCP)
{ {
logger.warning( // have to wait a client connection to add a STUN socket
"Failed to create a socket for:" // to the StunStack
+"\naddr:" + addr continue;
+"\npreferredPort:" + preferredPort
+"\nminPort:" + minPort
+"\nmaxPort:" + maxPort
+"\nprotocol:" + transport
+"\nContinuing with next address");
} }
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);
} }
} }

View File

@ -439,7 +439,7 @@ public class MultiplexingDatagramSocket
synchronized (receiveSyncRoot) synchronized (receiveSyncRoot)
{ {
inReceive = false; inReceive = false;
receiveSyncRoot.notifyAll(); receiveSyncRoot.notify();
} }
} }
} }

View File

@ -379,7 +379,7 @@ public class MultiplexingSocket
synchronized (receiveSyncRoot) synchronized (receiveSyncRoot)
{ {
inReceive = false; inReceive = false;
receiveSyncRoot.notifyAll(); receiveSyncRoot.notify();
} }
} }
} }