Merge branch 'master' into bugfix/tcp-harvester-interface-reuse

This commit is contained in:
Roberto Andrade 2015-08-05 12:49:36 -04:00
commit 9f03488376
230 changed files with 138 additions and 55 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/classes/
/classes-test/
/junit-reports/
/target/
/ice4j.jar

View File

@ -5,8 +5,8 @@
<property name="dest-test" value="classes-test"/> <property name="dest-test" value="classes-test"/>
<property name="lib" value="lib"/> <property name="lib" value="lib"/>
<property name="JUnit.home" value="${lib}"/> <property name="JUnit.home" value="${lib}"/>
<property name="src" value="src"/> <property name="src" value="src/main/java"/>
<property name="src2" value="test"/> <property name="src2" value="src/test/java"/>
<property name="junit.reports" value="junit-reports"/> <property name="junit.reports" value="junit-reports"/>
<property name="junit.html.reports" value="${junit.reports}/html"/> <property name="junit.html.reports" value="${junit.reports}/html"/>
<property name="ice4j.jar" value="ice4j.jar"/> <property name="ice4j.jar" value="ice4j.jar"/>

40
pom.xml
View File

@ -36,8 +36,17 @@
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>src</sourceDirectory> <plugins>
<testSourceDirectory>test</testSourceDirectory> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*TestSuite.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build> </build>
<profiles> <profiles>
@ -60,4 +69,31 @@
</build> </build>
</profile> </profile>
</profiles> </profiles>
<repositories>
<repository>
<id>jitsi-maven-repository-releases</id>
<layout>default</layout>
<name>Jitsi Maven Repository (Releases)</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/</url>
</repository>
<repository>
<id>jitsi-maven-repository-snapshots</id>
<layout>default</layout>
<name>Jitsi Maven Repository (Snapshots)</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/snapshots/</url>
</repository>
</repositories>
</project> </project>

View File

@ -38,7 +38,7 @@ public class DataAttribute
* *
* Some dialect does not add (and support) padding (GTalk). * Some dialect does not add (and support) padding (GTalk).
*/ */
private boolean padding = true; private final boolean padding;
/** /**
* Constructor. * Constructor.
@ -54,6 +54,7 @@ public class DataAttribute
protected DataAttribute(boolean padding) protected DataAttribute(boolean padding)
{ {
super(DATA); super(DATA);
this.padding = padding; this.padding = padding;
} }
@ -80,22 +81,26 @@ public class DataAttribute
*/ */
public byte[] encode() public byte[] encode()
{ {
char dataLength = getDataLength();
char type = getAttributeType(); char type = getAttributeType();
byte binValue[] = new byte[HEADER_LENGTH + getDataLength() + byte binary[]
(padding ? (getDataLength() % 4) : 0)]; = new byte[
HEADER_LENGTH
+ dataLength
+ (padding ? ((4 - dataLength % 4) % 4) : 0)];
//Type //Type
binValue[0] = (byte)(type >> 8); binary[0] = (byte)(type >> 8);
binValue[1] = (byte)(type & 0x00FF); binary[1] = (byte)(type & 0x00FF);
//Length //Length
binValue[2] = (byte)(getDataLength() >> 8); binary[2] = (byte)(dataLength >> 8);
binValue[3] = (byte)(getDataLength() & 0x00FF); binary[3] = (byte)(dataLength & 0x00FF);
//data //data
System.arraycopy(data, 0, binValue, 4, getDataLength()); System.arraycopy(data, 0, binary, 4, dataLength);
return binValue; return binary;
} }
/** /**

View File

@ -178,7 +178,7 @@ public class Agent
* repair the case where both agents believe to have the controlling or the * repair the case where both agents believe to have the controlling or the
* controlled role. * controlled role.
*/ */
private final long tieBreaker; private long tieBreaker;
/** /**
* Determines whether this is the controlling agent in a an ICE interaction. * Determines whether this is the controlling agent in a an ICE interaction.
@ -311,6 +311,16 @@ public class Agent
nominator = new DefaultNominator(this); nominator = new DefaultNominator(this);
} }
/**
* Sets the tie breaker value. Note that to this should be set early (before
* connectivity checks start).
* @param tieBreakerInput the value to set.
*/
public void setTieBreaker(long tieBreakerInput)
{
tieBreaker = tieBreakerInput;
}
/** /**
* Creates a new media stream and stores it. * Creates a new media stream and stores it.
* *

View File

@ -773,25 +773,33 @@ public abstract class Candidate<T extends Candidate<?>>
*/ */
protected int getDefaultPreference() protected int getDefaultPreference()
{ {
if( getType() == CandidateType.RELAYED_CANDIDATE) // https://tools.ietf.org/html/rfc5245#section-4.1.4
//
// It is RECOMMENDED that default candidates be chosen based on the
// likelihood of those candidates to work with the peer that is being
// contacted. It is RECOMMENDED that the default candidates are the
// relayed candidates (if relayed candidates are available), server
// reflexive candidates (if server reflexive candidates are available),
// and finally host candidates.
switch (getType())
{
case RELAYED_CANDIDATE:
return 30; return 30;
if( getType() == CandidateType.SERVER_REFLEXIVE_CANDIDATE) case SERVER_REFLEXIVE_CANDIDATE:
return 10;
if( getType() == CandidateType.HOST_CANDIDATE)
{
//prefer IPv4 as default since many servers would still freak out
//when seeing IPv6 address.
if(getTransportAddress().isIPv6())
return 20; return 20;
else
return 25;
}
case HOST_CANDIDATE:
// Prefer IPv4 as default since many servers would still freak out
// when seeing IPv6 address.
return getTransportAddress().isIPv6() ? 10 : 15;
default:
// WTF? // WTF?
return 5; return 5;
} }
}
/** /**
* Determines whether this <tt>Candidate</tt>'s<tt>TransportAddress</tt> is * Determines whether this <tt>Candidate</tt>'s<tt>TransportAddress</tt> is

View File

@ -691,21 +691,15 @@ public class Component
{ {
synchronized(localCandidates) synchronized(localCandidates)
{ {
Iterator<LocalCandidate> localCandsIter Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
= localCandidates.iterator();
while (localCandsIter.hasNext()) while (localCandsIter.hasNext())
{ {
LocalCandidate cand = localCandsIter.next(); LocalCandidate cand = localCandsIter.next();
if(this.defaultCandidate == null) if ((defaultCandidate == null)
{ || (defaultCandidate.getDefaultPreference()
this.defaultCandidate = cand; < cand.getDefaultPreference()))
continue;
}
if( defaultCandidate.getDefaultPreference()
< cand.getDefaultPreference())
{ {
defaultCandidate = cand; defaultCandidate = cand;
} }

Some files were not shown because too many files have changed in this diff Show More