Merge branch 'master' into bugfix/tcp-harvester-interface-reuse
This commit is contained in:
commit
9f03488376
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/classes/
|
||||
/classes-test/
|
||||
/junit-reports/
|
||||
/target/
|
||||
/ice4j.jar
|
||||
@ -5,8 +5,8 @@
|
||||
<property name="dest-test" value="classes-test"/>
|
||||
<property name="lib" value="lib"/>
|
||||
<property name="JUnit.home" value="${lib}"/>
|
||||
<property name="src" value="src"/>
|
||||
<property name="src2" value="test"/>
|
||||
<property name="src" value="src/main/java"/>
|
||||
<property name="src2" value="src/test/java"/>
|
||||
<property name="junit.reports" value="junit-reports"/>
|
||||
<property name="junit.html.reports" value="${junit.reports}/html"/>
|
||||
<property name="ice4j.jar" value="ice4j.jar"/>
|
||||
|
||||
40
pom.xml
40
pom.xml
@ -36,8 +36,17 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*TestSuite.*</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
@ -60,4 +69,31 @@
|
||||
</build>
|
||||
</profile>
|
||||
</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>
|
||||
|
||||
@ -38,12 +38,12 @@ public class DataAttribute
|
||||
*
|
||||
* Some dialect does not add (and support) padding (GTalk).
|
||||
*/
|
||||
private boolean padding = true;
|
||||
private final boolean padding;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected DataAttribute ()
|
||||
protected DataAttribute()
|
||||
{
|
||||
this(true);
|
||||
}
|
||||
@ -51,9 +51,10 @@ public class DataAttribute
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected DataAttribute (boolean padding)
|
||||
protected DataAttribute(boolean padding)
|
||||
{
|
||||
super(DATA);
|
||||
|
||||
this.padding = padding;
|
||||
}
|
||||
|
||||
@ -80,22 +81,26 @@ public class DataAttribute
|
||||
*/
|
||||
public byte[] encode()
|
||||
{
|
||||
char dataLength = getDataLength();
|
||||
char type = getAttributeType();
|
||||
byte binValue[] = new byte[HEADER_LENGTH + getDataLength() +
|
||||
(padding ? (getDataLength() % 4) : 0)];
|
||||
byte binary[]
|
||||
= new byte[
|
||||
HEADER_LENGTH
|
||||
+ dataLength
|
||||
+ (padding ? ((4 - dataLength % 4) % 4) : 0)];
|
||||
|
||||
//Type
|
||||
binValue[0] = (byte)(type >> 8);
|
||||
binValue[1] = (byte)(type & 0x00FF);
|
||||
binary[0] = (byte)(type >> 8);
|
||||
binary[1] = (byte)(type & 0x00FF);
|
||||
|
||||
//Length
|
||||
binValue[2] = (byte)(getDataLength() >> 8);
|
||||
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
||||
binary[2] = (byte)(dataLength >> 8);
|
||||
binary[3] = (byte)(dataLength & 0x00FF);
|
||||
|
||||
//data
|
||||
System.arraycopy(data, 0, binValue, 4, getDataLength());
|
||||
System.arraycopy(data, 0, binary, 4, dataLength);
|
||||
|
||||
return binValue;
|
||||
return binary;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,4 +174,4 @@ public class DataAttribute
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ public class Agent
|
||||
* repair the case where both agents believe to have the controlling or the
|
||||
* controlled role.
|
||||
*/
|
||||
private final long tieBreaker;
|
||||
private long tieBreaker;
|
||||
|
||||
/**
|
||||
* Determines whether this is the controlling agent in a an ICE interaction.
|
||||
@ -311,6 +311,16 @@ public class Agent
|
||||
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.
|
||||
*
|
||||
@ -773,24 +773,32 @@ public abstract class Candidate<T extends Candidate<?>>
|
||||
*/
|
||||
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;
|
||||
|
||||
if( getType() == CandidateType.SERVER_REFLEXIVE_CANDIDATE)
|
||||
return 10;
|
||||
case SERVER_REFLEXIVE_CANDIDATE:
|
||||
return 20;
|
||||
|
||||
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;
|
||||
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?
|
||||
return 5;
|
||||
}
|
||||
|
||||
//WTF?
|
||||
return 5;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -691,21 +691,15 @@ public class Component
|
||||
{
|
||||
synchronized(localCandidates)
|
||||
{
|
||||
Iterator<LocalCandidate> localCandsIter
|
||||
= localCandidates.iterator();
|
||||
Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
|
||||
|
||||
while (localCandsIter.hasNext())
|
||||
{
|
||||
LocalCandidate cand = localCandsIter.next();
|
||||
|
||||
if(this.defaultCandidate == null)
|
||||
{
|
||||
this.defaultCandidate = cand;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( defaultCandidate.getDefaultPreference()
|
||||
< cand.getDefaultPreference())
|
||||
if ((defaultCandidate == null)
|
||||
|| (defaultCandidate.getDefaultPreference()
|
||||
< cand.getDefaultPreference()))
|
||||
{
|
||||
defaultCandidate = cand;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user