commit
2014cb9fef
@ -245,7 +245,7 @@ public class StackProperties
|
|||||||
String[] parts = str.split(regex);
|
String[] parts = str.split(regex);
|
||||||
|
|
||||||
// Remove mal-formatted entries.
|
// Remove mal-formatted entries.
|
||||||
List<String> res = new ArrayList<String>();
|
List<String> res = new ArrayList<>();
|
||||||
for (String s : parts)
|
for (String s : parts)
|
||||||
if (s != null && s.trim().length() != 0)
|
if (s != null && s.trim().length() != 0)
|
||||||
res.add(s);
|
res.add(s);
|
||||||
|
|||||||
@ -74,14 +74,14 @@ public abstract class IceControlAttribute
|
|||||||
// the attributeValue array
|
// the attributeValue array
|
||||||
|
|
||||||
// Reading in the network byte order (Big-Endian)
|
// Reading in the network byte order (Big-Endian)
|
||||||
tieBreaker = ((attributeValue[offset++] & 0xffl) << 56)
|
tieBreaker = ((attributeValue[offset++] & 0xffL) << 56)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 48)
|
| ((attributeValue[offset++] & 0xffL) << 48)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 40)
|
| ((attributeValue[offset++] & 0xffL) << 40)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 32)
|
| ((attributeValue[offset++] & 0xffL) << 32)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 24)
|
| ((attributeValue[offset++] & 0xffL) << 24)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 16)
|
| ((attributeValue[offset++] & 0xffL) << 16)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 8)
|
| ((attributeValue[offset++] & 0xffL) << 8)
|
||||||
| (attributeValue[offset++] & 0xffl);
|
| (attributeValue[offset] & 0xffL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -144,7 +144,7 @@ public class LifetimeAttribute
|
|||||||
throw new StunException("length invalid");
|
throw new StunException("length invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
lifetime = ((attributeValue[offset + 0] << 24) & 0xff000000) +
|
lifetime = ((attributeValue[offset] << 24) & 0xff000000) +
|
||||||
((attributeValue[offset + 1] << 16) & 0x00ff0000) +
|
((attributeValue[offset + 1] << 16) & 0x00ff0000) +
|
||||||
((attributeValue[offset + 2] << 8) & 0x0000ff00) +
|
((attributeValue[offset + 2] << 8) & 0x0000ff00) +
|
||||||
(attributeValue[offset + 3] & 0x000000ff);
|
(attributeValue[offset + 3] & 0x000000ff);
|
||||||
|
|||||||
@ -131,7 +131,7 @@ public class ReservationTokenAttribute
|
|||||||
|
|
||||||
byte[] copy = new byte[reservationToken.length];
|
byte[] copy = new byte[reservationToken.length];
|
||||||
System.arraycopy(reservationToken, 0, copy, 0, reservationToken.length);
|
System.arraycopy(reservationToken, 0, copy, 0, reservationToken.length);
|
||||||
return reservationToken;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,8 +196,8 @@ public class ReservationTokenAttribute
|
|||||||
|
|
||||||
for(int i = 0; i < b; i++)
|
for(int i = 0; i < b; i++)
|
||||||
{
|
{
|
||||||
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFl);
|
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFL);
|
||||||
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFl);
|
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate hashcode for Hashtable storage.
|
//calculate hashcode for Hashtable storage.
|
||||||
|
|||||||
@ -121,7 +121,7 @@ public class SoftwareAttribute
|
|||||||
|
|
||||||
byte[] copy = new byte[software.length];
|
byte[] copy = new byte[software.length];
|
||||||
System.arraycopy(software, 0, copy, 0, software.length);
|
System.arraycopy(software, 0, copy, 0, software.length);
|
||||||
return software;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
/**
|
/**
|
||||||
* A list of attribute types that were not understood by the server.
|
* A list of attribute types that were not understood by the server.
|
||||||
*/
|
*/
|
||||||
private ArrayList<Character> unknownAttributes = new ArrayList<Character>();
|
private ArrayList<Character> unknownAttributes = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -100,7 +100,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
//some attributes may be repeated for padding
|
//some attributes may be repeated for padding
|
||||||
//(packet length should be divisable by 4)
|
//(packet length should be divisable by 4)
|
||||||
if(!contains(attributeID))
|
if(!contains(attributeID))
|
||||||
unknownAttributes.add(new Character(attributeID));
|
unknownAttributes.add(attributeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +110,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean contains(char attributeID)
|
public boolean contains(char attributeID)
|
||||||
{
|
{
|
||||||
return unknownAttributes.contains(new Character(attributeID));
|
return unknownAttributes.contains(attributeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +140,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public char getAttribute(int index )
|
public char getAttribute(int index )
|
||||||
{
|
{
|
||||||
return (unknownAttributes.get(index)).charValue();
|
return unknownAttributes.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +164,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
Iterator<Character> attributes = getAttributes();
|
Iterator<Character> attributes = getAttributes();
|
||||||
while (attributes.hasNext())
|
while (attributes.hasNext())
|
||||||
{
|
{
|
||||||
char att = attributes.next().charValue();
|
char att = attributes.next();
|
||||||
binValue[offset++] = (byte)(att >> 8);
|
binValue[offset++] = (byte)(att >> 8);
|
||||||
binValue[offset++] = (byte)(att & 0x00FF);
|
binValue[offset++] = (byte)(att & 0x00FF);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import java.util.logging.*;
|
|||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.harvest.*;
|
import org.ice4j.ice.harvest.*;
|
||||||
import org.ice4j.ice.harvest.TrickleCallback;
|
|
||||||
import org.ice4j.stack.*;
|
import org.ice4j.stack.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +107,7 @@ public class Agent
|
|||||||
* This map preserves the insertion order of the media streams.
|
* This map preserves the insertion order of the media streams.
|
||||||
*/
|
*/
|
||||||
private final Map<String, IceMediaStream> mediaStreams
|
private final Map<String, IceMediaStream> mediaStreams
|
||||||
= new LinkedHashMap<String, IceMediaStream>();
|
= new LinkedHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The candidate harvester that we use to gather candidate on the local
|
* The candidate harvester that we use to gather candidate on the local
|
||||||
@ -122,8 +121,7 @@ public class Agent
|
|||||||
* harvest candidates synchronously, and previously to harvesting by
|
* harvest candidates synchronously, and previously to harvesting by
|
||||||
* {@link #harvesters}.
|
* {@link #harvesters}.
|
||||||
*/
|
*/
|
||||||
private final List<CandidateHarvester> hostHarvesters
|
private final List<CandidateHarvester> hostHarvesters = new LinkedList<>();
|
||||||
= new LinkedList<CandidateHarvester>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of harvesters (i.e. STUN, TURN, and others) that the agent should
|
* The set of harvesters (i.e. STUN, TURN, and others) that the agent should
|
||||||
@ -166,7 +164,7 @@ public class Agent
|
|||||||
* the necessary triggered checks.
|
* the necessary triggered checks.
|
||||||
*/
|
*/
|
||||||
private final List<CandidatePair> preDiscoveredPairsQueue
|
private final List<CandidatePair> preDiscoveredPairsQueue
|
||||||
= new LinkedList<CandidatePair>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The lock that we use while starting connectivity establishment.
|
* The lock that we use while starting connectivity establishment.
|
||||||
@ -228,7 +226,7 @@ public class Agent
|
|||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> stateListeners
|
private final List<PropertyChangeListener> stateListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>StunStack</tt> used by this <tt>Agent</tt>.
|
* The <tt>StunStack</tt> used by this <tt>Agent</tt>.
|
||||||
@ -424,6 +422,28 @@ public class Agent
|
|||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a new {@link CandidatePair} instance from a
|
||||||
|
* {@link LocalCandidate} and a {@link RemoteCandidate}. The method
|
||||||
|
* represents a {@code CandidatePair} factory and is preferable to
|
||||||
|
* explicitly calling the {@code CandidatePair} constructor because it
|
||||||
|
* allows this {@code Agent} to easily track the initialization of its
|
||||||
|
* {@code CandidatePair}s.
|
||||||
|
*
|
||||||
|
* @param local the {@code LocalCandidate} to initialize the new instance
|
||||||
|
* with
|
||||||
|
* @param remote the {@code RemoteCandidate} to initialize the new instance
|
||||||
|
* with
|
||||||
|
* @return a new {@code CandidatePair} instance initializes with
|
||||||
|
* {@code local} and {@code remote}
|
||||||
|
*/
|
||||||
|
protected CandidatePair createCandidatePair(
|
||||||
|
LocalCandidate local,
|
||||||
|
RemoteCandidate remote)
|
||||||
|
{
|
||||||
|
return new CandidatePair(local, remote);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
||||||
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
||||||
@ -525,7 +545,7 @@ public class Agent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create a list of components and start harvesting
|
//create a list of components and start harvesting
|
||||||
List<Component> components = new LinkedList<Component>();
|
List<Component> components = new LinkedList<>();
|
||||||
|
|
||||||
for (IceMediaStream stream : getStreams())
|
for (IceMediaStream stream : getStreams())
|
||||||
{
|
{
|
||||||
@ -571,14 +591,12 @@ public class Agent
|
|||||||
"Trigger checks for pairs that were received before "
|
"Trigger checks for pairs that were received before "
|
||||||
+ "running state");
|
+ "running state");
|
||||||
|
|
||||||
Iterator<CandidatePair> it = preDiscoveredPairsQueue.iterator();
|
for (CandidatePair cp : preDiscoveredPairsQueue)
|
||||||
|
|
||||||
while(it.hasNext())
|
|
||||||
{
|
{
|
||||||
triggerCheck(it.next());
|
triggerCheck(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preDiscoveredPairsQueue.clear();
|
preDiscoveredPairsQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
connCheckClient.startChecks();
|
connCheckClient.startChecks();
|
||||||
@ -663,9 +681,9 @@ public class Agent
|
|||||||
*/
|
*/
|
||||||
public boolean isOver()
|
public boolean isOver()
|
||||||
{
|
{
|
||||||
return state == IceProcessingState.COMPLETED
|
IceProcessingState state = getState();
|
||||||
|| state == IceProcessingState.TERMINATED
|
|
||||||
|| state == IceProcessingState.FAILED;
|
return (state != null) && state.isOver();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -689,7 +707,7 @@ public class Agent
|
|||||||
synchronized(stateListeners)
|
synchronized(stateListeners)
|
||||||
{
|
{
|
||||||
if(!stateListeners.contains(l))
|
if(!stateListeners.contains(l))
|
||||||
this.stateListeners.add(l);
|
stateListeners.add(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +721,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(stateListeners)
|
synchronized(stateListeners)
|
||||||
{
|
{
|
||||||
this.stateListeners.remove(l);
|
stateListeners.remove(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,7 +1060,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(mediaStreams)
|
synchronized(mediaStreams)
|
||||||
{
|
{
|
||||||
return new LinkedList<String>(mediaStreams.keySet());
|
return new LinkedList<>(mediaStreams.keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,7 +1075,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(mediaStreams)
|
synchronized(mediaStreams)
|
||||||
{
|
{
|
||||||
return new LinkedList<IceMediaStream>(mediaStreams.values());
|
return new LinkedList<>(mediaStreams.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1449,7 +1467,7 @@ public class Agent
|
|||||||
ufrag);
|
ufrag);
|
||||||
|
|
||||||
CandidatePair triggeredPair
|
CandidatePair triggeredPair
|
||||||
= new CandidatePair(localCandidate, remoteCandidate);
|
= createCandidatePair(localCandidate, remoteCandidate);
|
||||||
|
|
||||||
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
||||||
triggeredPair.toShortString());
|
triggeredPair.toShortString());
|
||||||
@ -1619,23 +1637,24 @@ public class Agent
|
|||||||
public synchronized void nominate(CandidatePair pair)
|
public synchronized void nominate(CandidatePair pair)
|
||||||
throws IllegalStateException
|
throws IllegalStateException
|
||||||
{
|
{
|
||||||
if(! isControlling() )
|
if(!isControlling())
|
||||||
throw new IllegalStateException("Only controlling agents can "
|
{
|
||||||
+"nominate pairs");
|
throw new IllegalStateException(
|
||||||
|
"Only controlling agents can nominate pairs");
|
||||||
|
}
|
||||||
|
|
||||||
Component parentComponent = pair.getParentComponent();
|
Component parentComponent = pair.getParentComponent();
|
||||||
IceMediaStream parentStream = parentComponent.getParentStream();
|
IceMediaStream parentStream = parentComponent.getParentStream();
|
||||||
|
|
||||||
//If the pair is not already nominated and if its parent component
|
//If the pair is not already nominated and if its parent component
|
||||||
//does not already contain a nominated pair - nominate it.
|
//does not already contain a nominated pair - nominate it.
|
||||||
if(!pair.isNominated()
|
if (!pair.isNominated()
|
||||||
&& !parentStream.validListContainsNomineeForComponent(
|
&& !parentStream.validListContainsNomineeForComponent(
|
||||||
parentComponent))
|
parentComponent))
|
||||||
{
|
{
|
||||||
logger.info("verify if nominated pair answer again");
|
logger.info("verify if nominated pair answer again");
|
||||||
pair.nominate();
|
pair.nominate();
|
||||||
pair.getParentComponent().getParentStream()
|
parentStream.getCheckList().scheduleTriggeredCheck(pair);
|
||||||
.getCheckList().scheduleTriggeredCheck(pair);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
/**
|
/**
|
||||||
* The transport address represented by this candidate.
|
* The transport address represented by this candidate.
|
||||||
*/
|
*/
|
||||||
private TransportAddress transportAddress = null;
|
private final TransportAddress transportAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of this candidate. At this point the ICE specification (and
|
* The type of this candidate. At this point the ICE specification (and
|
||||||
@ -70,7 +70,7 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
* server reflexive, peer reflexive and relayed candidates. Others may be
|
* server reflexive, peer reflexive and relayed candidates. Others may be
|
||||||
* added in the future.
|
* added in the future.
|
||||||
*/
|
*/
|
||||||
private CandidateType candidateType = null;
|
private CandidateType candidateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary string that is the same for two candidates
|
* An arbitrary string that is the same for two candidates
|
||||||
@ -341,6 +341,20 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
&& getFoundation().equals(candidate.getFoundation());
|
&& getFoundation().equals(candidate.getFoundation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
// Even if the following hashCode algorithm has drawbacks because of it
|
||||||
|
// simplicity, it is better than nothing because at least it allows
|
||||||
|
// Candidate and, respectively, CandidatePair to be used as HashMap
|
||||||
|
// keys.
|
||||||
|
return
|
||||||
|
getParentComponent().hashCode() + getTransportAddress().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to the <tt>Component</tt> that this candidate belongs
|
* Returns a reference to the <tt>Component</tt> that this candidate belongs
|
||||||
* to.
|
* to.
|
||||||
@ -956,24 +970,24 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
TransportAddress relatedAddress = null;
|
TransportAddress relatedAddress = null;
|
||||||
switch (getType())
|
switch (getType())
|
||||||
{
|
{
|
||||||
case SERVER_REFLEXIVE_CANDIDATE:
|
case SERVER_REFLEXIVE_CANDIDATE:
|
||||||
if(getBase() != null)
|
if(getBase() != null)
|
||||||
{
|
{
|
||||||
relatedAddress = getBase().getTransportAddress();
|
relatedAddress = getBase().getTransportAddress();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PEER_REFLEXIVE_CANDIDATE:
|
case PEER_REFLEXIVE_CANDIDATE:
|
||||||
if(getBase() != null)
|
if(getBase() != null)
|
||||||
{
|
{
|
||||||
relatedAddress = getBase().getTransportAddress();
|
relatedAddress = getBase().getTransportAddress();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RELAYED_CANDIDATE:
|
case RELAYED_CANDIDATE:
|
||||||
relatedAddress = getMappedAddress();
|
relatedAddress = getMappedAddress();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//host candidate
|
//host candidate
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Update the related candidate conforming to the related address.
|
// Update the related candidate conforming to the related address.
|
||||||
this.relatedCandidate = findRelatedCandidate(relatedAddress);
|
this.relatedCandidate = findRelatedCandidate(relatedAddress);
|
||||||
|
|||||||
@ -131,7 +131,6 @@ public class CandidatePair
|
|||||||
public CandidatePair(LocalCandidate localCandidate,
|
public CandidatePair(LocalCandidate localCandidate,
|
||||||
RemoteCandidate remoteCandidate)
|
RemoteCandidate remoteCandidate)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.localCandidate = localCandidate;
|
this.localCandidate = localCandidate;
|
||||||
this.remoteCandidate = remoteCandidate;
|
this.remoteCandidate = remoteCandidate;
|
||||||
|
|
||||||
@ -449,14 +448,28 @@ public class CandidatePair
|
|||||||
|
|
||||||
CandidatePair candidatePair = (CandidatePair) obj;
|
CandidatePair candidatePair = (CandidatePair) obj;
|
||||||
|
|
||||||
//DO NOT change this method to also depend on other pair properties
|
// XXX DO NOT change this method to also depend on other pair properties
|
||||||
//because the Conn Check Client counts on it only using the candidates
|
// because ConnectivityCheckClient counts on it only using the
|
||||||
//for comparisons.
|
// candidates for comparisons.
|
||||||
return
|
return
|
||||||
localCandidate.equals(candidatePair.localCandidate)
|
localCandidate.equals(candidatePair.localCandidate)
|
||||||
&& remoteCandidate.equals(candidatePair.remoteCandidate);
|
&& remoteCandidate.equals(candidatePair.remoteCandidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
// Even if the following hashCode algorithm has drawbacks because of it
|
||||||
|
// simplicity, it is better than nothing because at least it allows
|
||||||
|
// CandidatePair to be used as a HashMap key.
|
||||||
|
// XXX While localCandidate is not final, the parentComponent is
|
||||||
|
// supposedly effectively final.
|
||||||
|
return getLocalCandidate().getParentComponent().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a String representation of this <tt>CandidatePair</tt>.
|
* Returns a String representation of this <tt>CandidatePair</tt>.
|
||||||
*
|
*
|
||||||
@ -616,8 +629,8 @@ public class CandidatePair
|
|||||||
getParentComponent().getParentStream().firePairPropertyChange(
|
getParentComponent().getParentStream().firePairPropertyChange(
|
||||||
this,
|
this,
|
||||||
IceMediaStream.PROPERTY_PAIR_NOMINATED,
|
IceMediaStream.PROPERTY_PAIR_NOMINATED,
|
||||||
false,
|
/* oldValue */ false,
|
||||||
true);
|
/* newValue */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -56,8 +56,7 @@ public class CheckList
|
|||||||
* A pair would get into a triggered check queue as soon as we receive
|
* A pair would get into a triggered check queue as soon as we receive
|
||||||
* a check on its local candidate.
|
* a check on its local candidate.
|
||||||
*/
|
*/
|
||||||
private final List<CandidatePair> triggeredCheckQueue
|
private final List<CandidatePair> triggeredCheckQueue = new LinkedList<>();
|
||||||
= new LinkedList<CandidatePair>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to the {@link IceMediaStream} that we belong to.
|
* A reference to the {@link IceMediaStream} that we belong to.
|
||||||
@ -69,14 +68,14 @@ public class CheckList
|
|||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> stateListeners
|
private final List<PropertyChangeListener> stateListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains {@link PropertyChangeListener}s registered with this {@link
|
* Contains {@link PropertyChangeListener}s registered with this {@link
|
||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> checkListeners
|
private final List<PropertyChangeListener> checkListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
||||||
@ -297,8 +296,7 @@ public class CheckList
|
|||||||
*/
|
*/
|
||||||
protected synchronized void computeInitialCheckListPairStates()
|
protected synchronized void computeInitialCheckListPairStates()
|
||||||
{
|
{
|
||||||
Map<String, CandidatePair> pairsToWait
|
Map<String, CandidatePair> pairsToWait = new Hashtable<>();
|
||||||
= new Hashtable<String, CandidatePair>();
|
|
||||||
|
|
||||||
//first, determine the pairs that we'd need to put in the waiting state.
|
//first, determine the pairs that we'd need to put in the waiting state.
|
||||||
for(CandidatePair pair : this)
|
for(CandidatePair pair : this)
|
||||||
@ -385,9 +383,9 @@ public class CheckList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Selected pair for stream " +
|
logger.info(
|
||||||
cmp.toShortString() + ": " +
|
"Selected pair for stream " + cmp.toShortString() + ": "
|
||||||
nominatedPair.toShortString());
|
+ nominatedPair.toShortString());
|
||||||
|
|
||||||
cmp.setSelectedPair(nominatedPair);
|
cmp.setSelectedPair(nominatedPair);
|
||||||
|
|
||||||
@ -508,8 +506,7 @@ public class CheckList
|
|||||||
|
|
||||||
synchronized(stateListeners)
|
synchronized(stateListeners)
|
||||||
{
|
{
|
||||||
listenersCopy
|
listenersCopy = new LinkedList<>(stateListeners);
|
||||||
= new LinkedList<PropertyChangeListener>(stateListeners);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChangeEvent evt = new PropertyChangeEvent(
|
PropertyChangeEvent evt = new PropertyChangeEvent(
|
||||||
@ -564,8 +561,7 @@ public class CheckList
|
|||||||
|
|
||||||
synchronized(checkListeners)
|
synchronized(checkListeners)
|
||||||
{
|
{
|
||||||
listenersCopy
|
listenersCopy = new LinkedList<>(checkListeners);
|
||||||
= new LinkedList<PropertyChangeListener>(checkListeners);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChangeEvent evt = new PropertyChangeEvent(
|
PropertyChangeEvent evt = new PropertyChangeEvent(
|
||||||
|
|||||||
@ -73,21 +73,19 @@ public class Component
|
|||||||
/**
|
/**
|
||||||
* The list locally gathered candidates for this media stream.
|
* The list locally gathered candidates for this media stream.
|
||||||
*/
|
*/
|
||||||
private final List<LocalCandidate> localCandidates
|
private final List<LocalCandidate> localCandidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of candidates that the peer agent sent for this stream.
|
* The list of candidates that the peer agent sent for this stream.
|
||||||
*/
|
*/
|
||||||
private final List<RemoteCandidate> remoteCandidates
|
private final List<RemoteCandidate> remoteCandidates = new LinkedList<>();
|
||||||
= new LinkedList<RemoteCandidate>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of candidates that the peer agent sent for this stream after
|
* The list of candidates that the peer agent sent for this stream after
|
||||||
* connectivity establishment.
|
* connectivity establishment.
|
||||||
*/
|
*/
|
||||||
private final List<RemoteCandidate> remoteUpdateCandidates =
|
private final List<RemoteCandidate> remoteUpdateCandidates
|
||||||
new LinkedList<RemoteCandidate>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <tt>Comparator</tt> that we use for sorting <tt>Candidate</tt>s by
|
* A <tt>Comparator</tt> that we use for sorting <tt>Candidate</tt>s by
|
||||||
@ -185,7 +183,7 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
return new ArrayList<LocalCandidate>(localCandidates);
|
return new ArrayList<>(localCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,8 +255,7 @@ public class Component
|
|||||||
logger.info("Update remote candidate for " + toShortString() + ": " +
|
logger.info("Update remote candidate for " + toShortString() + ": " +
|
||||||
candidate.getTransportAddress());
|
candidate.getTransportAddress());
|
||||||
|
|
||||||
List<RemoteCandidate> existingCandidates
|
List<RemoteCandidate> existingCandidates = new LinkedList<>();
|
||||||
= new LinkedList<RemoteCandidate>();
|
|
||||||
synchronized (remoteCandidates)
|
synchronized (remoteCandidates)
|
||||||
{
|
{
|
||||||
existingCandidates.addAll(remoteCandidates);
|
existingCandidates.addAll(remoteCandidates);
|
||||||
@ -292,7 +289,7 @@ public class Component
|
|||||||
*/
|
*/
|
||||||
public void updateRemoteCandidates()
|
public void updateRemoteCandidates()
|
||||||
{
|
{
|
||||||
List<CandidatePair> checkList = null;
|
List<CandidatePair> checkList;
|
||||||
List<RemoteCandidate> newRemoteCandidates;
|
List<RemoteCandidate> newRemoteCandidates;
|
||||||
|
|
||||||
synchronized(remoteUpdateCandidates)
|
synchronized(remoteUpdateCandidates)
|
||||||
@ -300,8 +297,7 @@ public class Component
|
|||||||
if(remoteUpdateCandidates.size() == 0)
|
if(remoteUpdateCandidates.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newRemoteCandidates
|
newRemoteCandidates = new LinkedList<>(remoteUpdateCandidates);
|
||||||
= new LinkedList<RemoteCandidate>(remoteUpdateCandidates);
|
|
||||||
|
|
||||||
List<LocalCandidate> localCnds = getLocalCandidates();
|
List<LocalCandidate> localCnds = getLocalCandidates();
|
||||||
|
|
||||||
@ -315,7 +311,7 @@ public class Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkList = new Vector<CandidatePair>();
|
checkList = new Vector<>();
|
||||||
|
|
||||||
for(LocalCandidate localCnd : localCnds)
|
for(LocalCandidate localCnd : localCnds)
|
||||||
{
|
{
|
||||||
@ -346,7 +342,9 @@ public class Component
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CandidatePair pair
|
CandidatePair pair
|
||||||
= new CandidatePair(localCnd, remoteCnd);
|
= getParentStream()
|
||||||
|
.getParentAgent()
|
||||||
|
.createCandidatePair(localCnd, remoteCnd);
|
||||||
logger.info("new Pair added: " + pair.toShortString());
|
logger.info("new Pair added: " + pair.toShortString());
|
||||||
checkList.add(pair);
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
@ -391,7 +389,7 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(remoteCandidates)
|
synchronized(remoteCandidates)
|
||||||
{
|
{
|
||||||
return new ArrayList<RemoteCandidate>(remoteCandidates);
|
return new ArrayList<>(remoteCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,15 +457,17 @@ public class Component
|
|||||||
StringBuffer buff
|
StringBuffer buff
|
||||||
= new StringBuffer("Component id=").append(getComponentID());
|
= new StringBuffer("Component id=").append(getComponentID());
|
||||||
|
|
||||||
buff.append(" parent stream=" + getParentStream().getName());
|
buff.append(" parent stream=").append(getParentStream().getName());
|
||||||
|
|
||||||
//local candidates
|
//local candidates
|
||||||
int localCandidatesCount = getLocalCandidateCount();
|
int localCandidatesCount = getLocalCandidateCount();
|
||||||
|
|
||||||
if(localCandidatesCount > 0)
|
if(localCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
buff.append("\n" + localCandidatesCount + " Local candidates:");
|
buff.append("\n")
|
||||||
buff.append("\ndefault candidate: " + getDefaultCandidate());
|
.append(localCandidatesCount)
|
||||||
|
.append(" Local candidates:");
|
||||||
|
buff.append("\ndefault candidate: ").append(getDefaultCandidate());
|
||||||
|
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
@ -487,14 +487,16 @@ public class Component
|
|||||||
|
|
||||||
if(remoteCandidatesCount > 0)
|
if(remoteCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
buff.append("\n" + remoteCandidatesCount + " Remote candidates:");
|
buff.append("\n")
|
||||||
buff.append("\ndefault remote candidate: "
|
.append(remoteCandidatesCount)
|
||||||
+ getDefaultRemoteCandidate());
|
.append(" Remote candidates:");
|
||||||
|
buff.append("\ndefault remote candidate: ")
|
||||||
|
.append(getDefaultRemoteCandidate());
|
||||||
synchronized(remoteCandidates)
|
synchronized(remoteCandidates)
|
||||||
{
|
{
|
||||||
for (RemoteCandidate cand : remoteCandidates)
|
for (RemoteCandidate cand : remoteCandidates)
|
||||||
{
|
{
|
||||||
buff.append("\n" + cand.toString());
|
buff.append("\n").append(cand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -701,12 +703,8 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
|
for (LocalCandidate cand : localCandidates)
|
||||||
|
|
||||||
while (localCandsIter.hasNext())
|
|
||||||
{
|
{
|
||||||
LocalCandidate cand = localCandsIter.next();
|
|
||||||
|
|
||||||
if ((defaultCandidate == null)
|
if ((defaultCandidate == null)
|
||||||
|| (defaultCandidate.getDefaultPreference()
|
|| (defaultCandidate.getDefaultPreference()
|
||||||
< cand.getDefaultPreference()))
|
< cand.getDefaultPreference()))
|
||||||
|
|||||||
@ -57,13 +57,13 @@ class ConnectivityCheckClient
|
|||||||
/**
|
/**
|
||||||
* The {@link PaceMaker}s that are currently running checks in this client.
|
* The {@link PaceMaker}s that are currently running checks in this client.
|
||||||
*/
|
*/
|
||||||
private final List<PaceMaker> paceMakers = new LinkedList<PaceMaker>();
|
private final List<PaceMaker> paceMakers = new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer that is used to let some seconds before a CheckList is considered
|
* Timer that is used to let some seconds before a CheckList is considered
|
||||||
* as FAILED.
|
* as FAILED.
|
||||||
*/
|
*/
|
||||||
private Map<String, Timer> timers = new HashMap<String, Timer>();
|
private Map<String, Timer> timers = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag that determines whether we have received a STUN response or not.
|
* A flag that determines whether we have received a STUN response or not.
|
||||||
@ -248,7 +248,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
//if we are the controlling agent then we need to indicate our
|
//if we are the controlling agent then we need to indicate our
|
||||||
//nominated pairs.
|
//nominated pairs.
|
||||||
if(candidatePair.isNominated())
|
if (candidatePair.isNominated())
|
||||||
{
|
{
|
||||||
logger.fine(
|
logger.fine(
|
||||||
"Add USE-CANDIDATE in check for: "
|
"Add USE-CANDIDATE in check for: "
|
||||||
@ -485,7 +485,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
TransportAddress mappedAddress = null;
|
TransportAddress mappedAddress = null;
|
||||||
|
|
||||||
if(! response.containsAttribute(Attribute.XOR_MAPPED_ADDRESS))
|
if (!response.containsAttribute(Attribute.XOR_MAPPED_ADDRESS))
|
||||||
{
|
{
|
||||||
logger.fine("Received a success response with no "
|
logger.fine("Received a success response with no "
|
||||||
+ "XOR_MAPPED_ADDRESS attribute.");
|
+ "XOR_MAPPED_ADDRESS attribute.");
|
||||||
@ -496,14 +496,14 @@ class ConnectivityCheckClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
XorMappedAddressAttribute mappedAddressAttr
|
XorMappedAddressAttribute mappedAddressAttr
|
||||||
= (XorMappedAddressAttribute)response
|
= (XorMappedAddressAttribute)
|
||||||
.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
|
response.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
|
||||||
|
|
||||||
mappedAddress = mappedAddressAttr
|
mappedAddress
|
||||||
.getAddress(response.getTransactionID());
|
= mappedAddressAttr.getAddress(response.getTransactionID());
|
||||||
|
|
||||||
// XXX AddressAttribute always returns UDP based TransportAddress
|
// XXX AddressAttribute always returns UDP based TransportAddress
|
||||||
if(checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
|
if (checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
|
||||||
{
|
{
|
||||||
mappedAddress
|
mappedAddress
|
||||||
= new TransportAddress(
|
= new TransportAddress(
|
||||||
@ -514,8 +514,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
LocalCandidate validLocalCandidate = null;
|
LocalCandidate validLocalCandidate = null;
|
||||||
|
|
||||||
validLocalCandidate = parentAgent
|
validLocalCandidate = parentAgent.findLocalCandidate(mappedAddress);
|
||||||
.findLocalCandidate(mappedAddress);
|
|
||||||
|
|
||||||
RemoteCandidate validRemoteCandidate = checkedPair.getRemoteCandidate();
|
RemoteCandidate validRemoteCandidate = checkedPair.getRemoteCandidate();
|
||||||
|
|
||||||
@ -523,7 +522,7 @@ class ConnectivityCheckClient
|
|||||||
// response. If the transport address does not match any of the
|
// response. If the transport address does not match any of the
|
||||||
// local candidates that the agent knows about, the mapped address
|
// local candidates that the agent knows about, the mapped address
|
||||||
// represents a new candidate -- a peer reflexive candidate.
|
// represents a new candidate -- a peer reflexive candidate.
|
||||||
if ( validLocalCandidate == null)
|
if (validLocalCandidate == null)
|
||||||
{
|
{
|
||||||
//Like other candidates, PEER-REFLEXIVE candidates have a type,
|
//Like other candidates, PEER-REFLEXIVE candidates have a type,
|
||||||
//base, priority, and foundation. They are computed as follows:
|
//base, priority, and foundation. They are computed as follows:
|
||||||
@ -557,9 +556,12 @@ class ConnectivityCheckClient
|
|||||||
//generated from it momentarily
|
//generated from it momentarily
|
||||||
validLocalCandidate = peerReflexiveCandidate;
|
validLocalCandidate = peerReflexiveCandidate;
|
||||||
|
|
||||||
if(checkedPair.getParentComponent().getSelectedPair() == null)
|
if (checkedPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Receive a peer-reflexive candidate: " +
|
{
|
||||||
peerReflexiveCandidate.getTransportAddress());
|
logger.info(
|
||||||
|
"Receive a peer-reflexive candidate: "
|
||||||
|
+ peerReflexiveCandidate.getTransportAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the resulting valid pair was already in our check lists.
|
//check if the resulting valid pair was already in our check lists.
|
||||||
@ -575,7 +577,9 @@ class ConnectivityCheckClient
|
|||||||
// by a STUN connectivity check.
|
// by a STUN connectivity check.
|
||||||
CandidatePair validPair
|
CandidatePair validPair
|
||||||
= (existingPair == null)
|
= (existingPair == null)
|
||||||
? new CandidatePair(validLocalCandidate, validRemoteCandidate)
|
? parentAgent.createCandidatePair(
|
||||||
|
validLocalCandidate,
|
||||||
|
validRemoteCandidate)
|
||||||
: existingPair;
|
: existingPair;
|
||||||
|
|
||||||
// we synchronize here because the same pair object can be processed (in
|
// we synchronize here because the same pair object can be processed (in
|
||||||
@ -586,38 +590,42 @@ class ConnectivityCheckClient
|
|||||||
// (for the same check) from other peer come at the very same time, that
|
// (for the same check) from other peer come at the very same time, that
|
||||||
// we will trigger the nominationConfirmed (that will pass the pair as
|
// we will trigger the nominationConfirmed (that will pass the pair as
|
||||||
// as selected if it is the first time).
|
// as selected if it is the first time).
|
||||||
synchronized(checkedPair)
|
synchronized (checkedPair)
|
||||||
{
|
{
|
||||||
//The agent sets the state of the pair that *generated* the check to
|
//The agent sets the state of the pair that *generated* the check to
|
||||||
//Succeeded. Note that, the pair which *generated* the check may be
|
//Succeeded. Note that, the pair which *generated* the check may be
|
||||||
//different than the valid pair constructed above
|
//different than the valid pair constructed above
|
||||||
if(checkedPair.getParentComponent().getSelectedPair() == null)
|
if (checkedPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Pair succeeded: " + checkedPair.toShortString());
|
logger.info("Pair succeeded: " + checkedPair.toShortString());
|
||||||
checkedPair.setStateSucceeded();
|
checkedPair.setStateSucceeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! validPair.isValid())
|
if (!validPair.isValid())
|
||||||
{
|
{
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if (validPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Pair validated: " + validPair.toShortString());
|
logger.info("Pair validated: " + validPair.toShortString());
|
||||||
parentAgent.validatePair(validPair);
|
parentAgent.validatePair(validPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
//The agent changes the states for all other Frozen pairs for the
|
//The agent changes the states for all other Frozen pairs for the
|
||||||
//same media stream and same foundation to Waiting.
|
//same media stream and same foundation to Waiting.
|
||||||
IceMediaStream parentStream = checkedPair.getParentComponent()
|
IceMediaStream parentStream
|
||||||
.getParentStream();
|
= checkedPair.getParentComponent().getParentStream();
|
||||||
|
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
{
|
{
|
||||||
Vector<CandidatePair> parentCheckList
|
Vector<CandidatePair> parentCheckList
|
||||||
= new Vector<CandidatePair>(parentStream.getCheckList());
|
= new Vector<>(parentStream.getCheckList());
|
||||||
|
|
||||||
for(CandidatePair pair : parentCheckList)
|
for(CandidatePair pair : parentCheckList)
|
||||||
if ((pair.getState() == CandidatePairState.FROZEN)
|
{
|
||||||
|
if (pair.getState() == CandidatePairState.FROZEN
|
||||||
&& checkedPair.getFoundation().equals(
|
&& checkedPair.getFoundation().equals(
|
||||||
pair.getFoundation()))
|
pair.getFoundation()))
|
||||||
|
{
|
||||||
pair.setStateWaiting();
|
pair.setStateWaiting();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The agent examines the check list for all other streams in turn. If
|
// The agent examines the check list for all other streams in turn. If
|
||||||
@ -634,7 +642,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
synchronized (checkList)
|
synchronized (checkList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : checkList)
|
for (CandidatePair pair : checkList)
|
||||||
{
|
{
|
||||||
if (parentStream.validListContainsFoundation(
|
if (parentStream.validListContainsFoundation(
|
||||||
pair.getFoundation())
|
pair.getFoundation())
|
||||||
@ -650,7 +658,7 @@ class ConnectivityCheckClient
|
|||||||
//foundation, and for each group, sets the state of the pair with
|
//foundation, and for each group, sets the state of the pair with
|
||||||
//the lowest component ID to Waiting. If there is more than one
|
//the lowest component ID to Waiting. If there is more than one
|
||||||
//such pair, the one with the highest priority is used.
|
//such pair, the one with the highest priority is used.
|
||||||
if(checkList.isFrozen())
|
if (checkList.isFrozen())
|
||||||
checkList.computeInitialCheckListPairStates();
|
checkList.computeInitialCheckListPairStates();
|
||||||
|
|
||||||
if (wasFrozen)
|
if (wasFrozen)
|
||||||
@ -661,7 +669,7 @@ class ConnectivityCheckClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if (validPair.getParentComponent().getSelectedPair() == null)
|
||||||
{
|
{
|
||||||
logger.info("IsControlling: " + parentAgent.isControlling() +
|
logger.info("IsControlling: " + parentAgent.isControlling() +
|
||||||
" USE-CANDIDATE:" +
|
" USE-CANDIDATE:" +
|
||||||
@ -672,8 +680,8 @@ class ConnectivityCheckClient
|
|||||||
//If the agent was a controlling agent, and it had included a USE-
|
//If the agent was a controlling agent, and it had included a USE-
|
||||||
//CANDIDATE attribute in the Binding request, the valid pair generated
|
//CANDIDATE attribute in the Binding request, the valid pair generated
|
||||||
//from that check has its nominated flag set to true.
|
//from that check has its nominated flag set to true.
|
||||||
if((parentAgent.isControlling()
|
if (parentAgent.isControlling()
|
||||||
&& request.containsAttribute(Attribute.USE_CANDIDATE)))
|
&& request.containsAttribute(Attribute.USE_CANDIDATE))
|
||||||
{
|
{
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if(validPair.getParentComponent().getSelectedPair() == null)
|
||||||
{
|
{
|
||||||
@ -693,7 +701,7 @@ class ConnectivityCheckClient
|
|||||||
//itself had the USE-CANDIDATE attribute. This case is described in
|
//itself had the USE-CANDIDATE attribute. This case is described in
|
||||||
//Section 7.2.1.5, and may now result in setting the nominated flag for
|
//Section 7.2.1.5, and may now result in setting the nominated flag for
|
||||||
//the pair learned from the original request.
|
//the pair learned from the original request.
|
||||||
else if(!parentAgent.isControlling()
|
else if (!parentAgent.isControlling()
|
||||||
&& checkedPair.useCandidateReceived()
|
&& checkedPair.useCandidateReceived()
|
||||||
&& !checkedPair.isNominated())
|
&& !checkedPair.isNominated())
|
||||||
{
|
{
|
||||||
@ -702,7 +710,7 @@ class ConnectivityCheckClient
|
|||||||
logger.info(
|
logger.info(
|
||||||
"Nomination confirmed for pair: "
|
"Nomination confirmed for pair: "
|
||||||
+ validPair.toShortString());
|
+ validPair.toShortString());
|
||||||
parentAgent.nominationConfirmed( checkedPair );
|
parentAgent.nominationConfirmed(checkedPair);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,8 +50,7 @@ public class DefaultNominator
|
|||||||
* Map that will remember association between validated relayed candidate
|
* Map that will remember association between validated relayed candidate
|
||||||
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy.
|
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy.
|
||||||
*/
|
*/
|
||||||
private final Map<String, TimerTask> validatedCandidates
|
private final Map<String, TimerTask> validatedCandidates = new HashMap<>();
|
||||||
= new HashMap<String, TimerTask>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of this nominator using <tt>parentAgent</tt> as
|
* Creates a new instance of this nominator using <tt>parentAgent</tt> as
|
||||||
@ -323,7 +322,7 @@ public class DefaultNominator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allFailed && !pair.isNominated())
|
if (allFailed && !pair.isNominated())
|
||||||
{
|
{
|
||||||
// all other pairs are failed to do not waste time, cancel
|
// all other pairs are failed to do not waste time, cancel
|
||||||
// timer and nominate ourself (the relayed candidate).
|
// timer and nominate ourself (the relayed candidate).
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class FoundationsRegistry
|
|||||||
* Contains mappings between a type+baseIP+server+transport
|
* Contains mappings between a type+baseIP+server+transport
|
||||||
* <tt>String</tt>s and the foundation that has been assigned to them.
|
* <tt>String</tt>s and the foundation that has been assigned to them.
|
||||||
*/
|
*/
|
||||||
private Map<String, String> foundations = new Hashtable<String, String>();
|
private Map<String, String> foundations = new Hashtable<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns to <tt>candidate</tt> the foundation that corresponds to its
|
* Assigns to <tt>candidate</tt> the foundation that corresponds to its
|
||||||
|
|||||||
@ -75,8 +75,7 @@ public class IceMediaStream
|
|||||||
* address; a media stream may require multiple components, each of which
|
* address; a media stream may require multiple components, each of which
|
||||||
* has to work for the media stream as a whole to work.
|
* has to work for the media stream as a whole to work.
|
||||||
*/
|
*/
|
||||||
private final Map<Integer, Component> components
|
private final Map<Integer, Component> components = new LinkedHashMap<>();
|
||||||
= new LinkedHashMap<Integer, Component>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ordered set of candidate pairs for a media stream that have been
|
* An ordered set of candidate pairs for a media stream that have been
|
||||||
@ -84,8 +83,7 @@ public class IceMediaStream
|
|||||||
* start of ICE processing, and fills as checks are performed, resulting in
|
* start of ICE processing, and fills as checks are performed, resulting in
|
||||||
* valid candidate pairs.
|
* valid candidate pairs.
|
||||||
*/
|
*/
|
||||||
private final TreeSet<CandidatePair> validList
|
private final TreeSet<CandidatePair> validList = new TreeSet<>();
|
||||||
= new TreeSet<CandidatePair>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id that was last assigned to a component. The next id that we give
|
* The id that was last assigned to a component. The next id that we give
|
||||||
@ -110,7 +108,7 @@ public class IceMediaStream
|
|||||||
* Agent} and following the various events it may be generating.
|
* Agent} and following the various events it may be generating.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> streamListeners
|
private final List<PropertyChangeListener> streamListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum number of candidate pairs that we should have in our check
|
* The maximum number of candidate pairs that we should have in our check
|
||||||
@ -163,9 +161,7 @@ public class IceMediaStream
|
|||||||
synchronized (components)
|
synchronized (components)
|
||||||
{
|
{
|
||||||
component = new Component(++lastComponentID, this);
|
component = new Component(++lastComponentID, this);
|
||||||
components.put(
|
components.put(component.getComponentID(), component);
|
||||||
Integer.valueOf(component.getComponentID()),
|
|
||||||
component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
@ -231,7 +227,7 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
synchronized(components)
|
synchronized(components)
|
||||||
{
|
{
|
||||||
return new ArrayList<Component>(components.values());
|
return new ArrayList<>(components.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +257,7 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
synchronized(components)
|
synchronized(components)
|
||||||
{
|
{
|
||||||
return new ArrayList<Integer>(components.keySet());
|
return new ArrayList<>(components.keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,8 +394,9 @@ public class IceMediaStream
|
|||||||
if(localCnd.canReach(remoteCnd)
|
if(localCnd.canReach(remoteCnd)
|
||||||
&& remoteCnd.getTransportAddress().getPort() != 0)
|
&& remoteCnd.getTransportAddress().getPort() != 0)
|
||||||
{
|
{
|
||||||
CandidatePair pair = new CandidatePair(localCnd,
|
CandidatePair pair
|
||||||
remoteCnd);
|
= getParentAgent()
|
||||||
|
.createCandidatePair(localCnd, remoteCnd);
|
||||||
checkList.add(pair);
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,8 +433,7 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
//a list that we only use for storing pairs that we've already gone
|
//a list that we only use for storing pairs that we've already gone
|
||||||
//through. The list is destroyed at the end of this method.
|
//through. The list is destroyed at the end of this method.
|
||||||
List<CandidatePair> tmpCheckList
|
List<CandidatePair> tmpCheckList = new ArrayList<>(checkList.size());
|
||||||
= new ArrayList<CandidatePair>(checkList.size());
|
|
||||||
|
|
||||||
Iterator<CandidatePair> ckListIter = checkList.iterator();
|
Iterator<CandidatePair> ckListIter = checkList.iterator();
|
||||||
|
|
||||||
@ -694,9 +690,9 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
protected boolean validListContainsNomineeForComponent(Component component)
|
protected boolean validListContainsNomineeForComponent(Component component)
|
||||||
{
|
{
|
||||||
synchronized(validList)
|
synchronized (validList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : validList)
|
for (CandidatePair pair : validList)
|
||||||
{
|
{
|
||||||
if (pair.isNominated()
|
if (pair.isNominated()
|
||||||
&& pair.getParentComponent() == component)
|
&& pair.getParentComponent() == component)
|
||||||
@ -746,9 +742,9 @@ public class IceMediaStream
|
|||||||
|
|
||||||
synchronized (validList)
|
synchronized (validList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : validList)
|
for (CandidatePair pair : validList)
|
||||||
{
|
{
|
||||||
if(pair.isNominated())
|
if (pair.isNominated())
|
||||||
components.remove(pair.getParentComponent());
|
components.remove(pair.getParentComponent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ package org.ice4j.ice;
|
|||||||
* refer to with "Terminated".
|
* refer to with "Terminated".
|
||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
|
* @author Lyubomir Marinov
|
||||||
*/
|
*/
|
||||||
public enum IceProcessingState
|
public enum IceProcessingState
|
||||||
{
|
{
|
||||||
@ -99,6 +100,21 @@ public enum IceProcessingState
|
|||||||
return stateName;
|
return stateName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether an {@link Agent} in this state has finished its ICE
|
||||||
|
* processing.
|
||||||
|
*
|
||||||
|
* @return {@code true} if an {@code Agent} in this state has finished its
|
||||||
|
* ICE processing; otherwise, {@code false}
|
||||||
|
*/
|
||||||
|
public boolean isOver()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
COMPLETED.equals(this)
|
||||||
|
|| FAILED.equals(this)
|
||||||
|
|| TERMINATED.equals(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <tt>true</tt> iff the state is one in which a connection
|
* Returns <tt>true</tt> iff the state is one in which a connection
|
||||||
* has been established, that is either <tt>COMPLETED</tt> or
|
* has been established, that is either <tt>COMPLETED</tt> or
|
||||||
|
|||||||
@ -707,8 +707,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isLoopback");
|
Method method = iface.getClass().getMethod("isLoopback");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface, new Object[]{}))
|
return (Boolean) method.invoke(iface);
|
||||||
.booleanValue();
|
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
@ -739,7 +738,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isUp");
|
Method method = iface.getClass().getMethod("isUp");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface)).booleanValue();
|
return (Boolean) method.invoke(iface);
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
@ -769,7 +768,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isVirtual");
|
Method method = iface.getClass().getMethod("isVirtual");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface)).booleanValue();
|
return (Boolean) method.invoke(iface);
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,8 +38,7 @@ public class TcpHostCandidate
|
|||||||
/**
|
/**
|
||||||
* List of <tt>accept</tt>ed sockets for this <tt>TcpHostCandidate</tt>.
|
* List of <tt>accept</tt>ed sockets for this <tt>TcpHostCandidate</tt>.
|
||||||
*/
|
*/
|
||||||
private final List<IceSocketWrapper> sockets
|
private final List<IceSocketWrapper> sockets = new LinkedList<>();
|
||||||
= new LinkedList<IceSocketWrapper>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>TcpHostCandidate</tt>.
|
* Initializes a new <tt>TcpHostCandidate</tt>.
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class CandidateHarvesterSet
|
|||||||
* <tt>Set</tt>.
|
* <tt>Set</tt>.
|
||||||
*/
|
*/
|
||||||
private final Collection<CandidateHarvesterSetElement> elements
|
private final Collection<CandidateHarvesterSetElement> elements
|
||||||
= new LinkedList<CandidateHarvesterSetElement>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pool of thread used for gathering process.
|
* A pool of thread used for gathering process.
|
||||||
@ -95,7 +95,7 @@ public class CandidateHarvesterSet
|
|||||||
*/
|
*/
|
||||||
public void harvest(Component component)
|
public void harvest(Component component)
|
||||||
{
|
{
|
||||||
harvest(Arrays.asList(new Component[]{component}), null);
|
harvest(Arrays.asList(component), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,8 +145,7 @@ public class CandidateHarvesterSet
|
|||||||
* Start asynchronously executing the
|
* Start asynchronously executing the
|
||||||
* CandidateHarvester#harvest(Component) method of the harvesters.
|
* CandidateHarvester#harvest(Component) method of the harvesters.
|
||||||
*/
|
*/
|
||||||
Map<CandidateHarvesterSetTask, Future<?>> tasks
|
Map<CandidateHarvesterSetTask, Future<?>> tasks = new HashMap<>();
|
||||||
= new HashMap<CandidateHarvesterSetTask, Future<?>>();
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -171,7 +170,7 @@ public class CandidateHarvesterSet
|
|||||||
|
|
||||||
synchronized (components)
|
synchronized (components)
|
||||||
{
|
{
|
||||||
componentsCopy = new ArrayList<Component>(components);
|
componentsCopy = new ArrayList<>(components);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asynchronously start gathering candidates using the harvester.
|
// Asynchronously start gathering candidates using the harvester.
|
||||||
@ -194,7 +193,7 @@ public class CandidateHarvesterSet
|
|||||||
= taskIter.next();
|
= taskIter.next();
|
||||||
Future<?> future = task.getValue();
|
Future<?> future = task.getValue();
|
||||||
|
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -232,9 +231,9 @@ public class CandidateHarvesterSet
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
taskIter.remove();
|
taskIter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,7 +194,7 @@ public class HostCandidateHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allowedAddresses == null)
|
if (allowedAddresses == null)
|
||||||
allowedAddresses = new ArrayList<InetAddress>();
|
allowedAddresses = new ArrayList<>();
|
||||||
|
|
||||||
allowedAddresses.add(address);
|
allowedAddresses.add(address);
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ public class HostCandidateHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (blockedAddresses == null)
|
if (blockedAddresses == null)
|
||||||
blockedAddresses = new ArrayList<InetAddress>();
|
blockedAddresses = new ArrayList<>();
|
||||||
|
|
||||||
blockedAddresses.add(address);
|
blockedAddresses.add(address);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class MappingCandidateHarvester
|
|||||||
* Report the LocalCandidates gathered by this CandidateHarvester so
|
* Report the LocalCandidates gathered by this CandidateHarvester so
|
||||||
* that the harvest is sure to be considered successful.
|
* that the harvest is sure to be considered successful.
|
||||||
*/
|
*/
|
||||||
Collection<LocalCandidate> candidates = new HashSet<LocalCandidate>();
|
Collection<LocalCandidate> candidates = new HashSet<>();
|
||||||
|
|
||||||
for (Candidate<?> cand : component.getLocalCandidates())
|
for (Candidate<?> cand : component.getLocalCandidates())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -85,10 +85,9 @@ public class SinglePortUdpHarvester
|
|||||||
public static List<SinglePortUdpHarvester>
|
public static List<SinglePortUdpHarvester>
|
||||||
createHarvesters(int port)
|
createHarvesters(int port)
|
||||||
{
|
{
|
||||||
List<SinglePortUdpHarvester> harvesters
|
List<SinglePortUdpHarvester> harvesters = new LinkedList<>();
|
||||||
= new LinkedList<SinglePortUdpHarvester>();
|
|
||||||
|
|
||||||
List<TransportAddress> addresses = new LinkedList<TransportAddress>();
|
List<TransportAddress> addresses = new LinkedList<>();
|
||||||
boolean isIPv6Disabled = StackProperties.getBoolean(
|
boolean isIPv6Disabled = StackProperties.getBoolean(
|
||||||
StackProperties.DISABLE_IPv6,
|
StackProperties.DISABLE_IPv6,
|
||||||
false);
|
false);
|
||||||
@ -158,7 +157,7 @@ public class SinglePortUdpHarvester
|
|||||||
* other threads remove entries when candidates are freed.
|
* other threads remove entries when candidates are freed.
|
||||||
*/
|
*/
|
||||||
private final Map<SocketAddress, MySocket> sockets
|
private final Map<SocketAddress, MySocket> sockets
|
||||||
= new ConcurrentHashMap<SocketAddress, MySocket>();
|
= new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The map which keeps all currently active <tt>Candidate</tt>s created by
|
* The map which keeps all currently active <tt>Candidate</tt>s created by
|
||||||
@ -166,14 +165,14 @@ public class SinglePortUdpHarvester
|
|||||||
* the components for which the candidates are harvested.
|
* the components for which the candidates are harvested.
|
||||||
*/
|
*/
|
||||||
private final Map<String, MyCandidate> candidates
|
private final Map<String, MyCandidate> candidates
|
||||||
= new ConcurrentHashMap<String, MyCandidate>();
|
= new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pool of <tt>Buffer</tt> instances used to avoid creating of new java
|
* A pool of <tt>Buffer</tt> instances used to avoid creating of new java
|
||||||
* objects.
|
* objects.
|
||||||
*/
|
*/
|
||||||
private final ArrayBlockingQueue<Buffer> pool
|
private final ArrayBlockingQueue<Buffer> pool
|
||||||
= new ArrayBlockingQueue<Buffer>(POOL_SIZE);
|
= new ArrayBlockingQueue<>(POOL_SIZE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local address that this harvester is bound to.
|
* The local address that this harvester is bound to.
|
||||||
@ -235,7 +234,7 @@ public class SinglePortUdpHarvester
|
|||||||
MySocket destinationSocket;
|
MySocket destinationSocket;
|
||||||
InetSocketAddress remoteAddress;
|
InetSocketAddress remoteAddress;
|
||||||
|
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
// TODO: implement stopping the thread with a switch?
|
// TODO: implement stopping the thread with a switch?
|
||||||
|
|
||||||
@ -303,21 +302,19 @@ public class SinglePortUdpHarvester
|
|||||||
catch (SocketException se)
|
catch (SocketException se)
|
||||||
{
|
{
|
||||||
logger.info("Could not create a socket: " + se);
|
logger.info("Could not create a socket: " + se);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
catch (IOException ioe)
|
catch (IOException ioe)
|
||||||
{
|
{
|
||||||
logger.info("Failed to handle new socket: " + ioe);
|
logger.info("Failed to handle new socket: " + ioe);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// A STUN Binding Request with an unknown USERNAME. Drop it.
|
// A STUN Binding Request with an unknown USERNAME. Drop it.
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
|
|
||||||
// TODO we are all done, clean up.
|
// TODO we are all done, clean up.
|
||||||
}
|
}
|
||||||
@ -431,7 +428,7 @@ public class SinglePortUdpHarvester
|
|||||||
*/
|
*/
|
||||||
logger.info(
|
logger.info(
|
||||||
"More than one Component for an Agent, cannot harvest.");
|
"More than one Component for an Agent, cannot harvest.");
|
||||||
return new LinkedList<LocalCandidate>();
|
return new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCandidate candidate = new MyCandidate(component, ufrag);
|
MyCandidate candidate = new MyCandidate(component, ufrag);
|
||||||
@ -470,7 +467,7 @@ public class SinglePortUdpHarvester
|
|||||||
* The FIFO which acts as a buffer for this socket.
|
* The FIFO which acts as a buffer for this socket.
|
||||||
*/
|
*/
|
||||||
private final ArrayBlockingQueue<Buffer> queue
|
private final ArrayBlockingQueue<Buffer> queue
|
||||||
= new ArrayBlockingQueue<Buffer>(QUEUE_SIZE);
|
= new ArrayBlockingQueue<>(QUEUE_SIZE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link QueueStatistics} instance optionally used to collect and
|
* The {@link QueueStatistics} instance optionally used to collect and
|
||||||
@ -721,7 +718,7 @@ public class SinglePortUdpHarvester
|
|||||||
* a corresponding socket in {@link #sockets}.
|
* a corresponding socket in {@link #sockets}.
|
||||||
*/
|
*/
|
||||||
private final Map<SocketAddress, IceSocketWrapper> candidateSockets
|
private final Map<SocketAddress, IceSocketWrapper> candidateSockets
|
||||||
= new HashMap<SocketAddress, IceSocketWrapper>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The collection of <tt>DatagramSocket</tt>s added to this candidate.
|
* The collection of <tt>DatagramSocket</tt>s added to this candidate.
|
||||||
@ -731,7 +728,7 @@ public class SinglePortUdpHarvester
|
|||||||
* the STUN stack or the user of ice4j.
|
* the STUN stack or the user of ice4j.
|
||||||
*/
|
*/
|
||||||
private final Map<SocketAddress, DatagramSocket> sockets
|
private final Map<SocketAddress, DatagramSocket> sockets
|
||||||
= new HashMap<SocketAddress, DatagramSocket>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>MyCandidate</tt> instance with the given
|
* Initializes a new <tt>MyCandidate</tt> instance with the given
|
||||||
|
|||||||
@ -68,8 +68,7 @@ public class StunCandidateHarvest
|
|||||||
* The list of <tt>Candidate</tt>s harvested for {@link #hostCandidate} by
|
* The list of <tt>Candidate</tt>s harvested for {@link #hostCandidate} by
|
||||||
* this harvest.
|
* this harvest.
|
||||||
*/
|
*/
|
||||||
private final List<LocalCandidate> candidates
|
private final List<LocalCandidate> candidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The indicator which determines whether this <tt>StunCandidateHarvest</tt>
|
* The indicator which determines whether this <tt>StunCandidateHarvest</tt>
|
||||||
@ -104,8 +103,7 @@ public class StunCandidateHarvest
|
|||||||
* to which a STUN <tt>Response</tt> responds available though it is known
|
* to which a STUN <tt>Response</tt> responds available though it is known
|
||||||
* in <tt>StunClientTransaction</tt>.
|
* in <tt>StunClientTransaction</tt>.
|
||||||
*/
|
*/
|
||||||
private final Map<TransactionID, Request> requests
|
private final Map<TransactionID, Request> requests = new HashMap<>();
|
||||||
= new HashMap<TransactionID, Request>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interval in milliseconds at which a new STUN keep-alive message is to
|
* The interval in milliseconds at which a new STUN keep-alive message is to
|
||||||
@ -1448,7 +1446,7 @@ public class StunCandidateHarvest
|
|||||||
*/
|
*/
|
||||||
public SendKeepAliveMessageThread(StunCandidateHarvest harvest)
|
public SendKeepAliveMessageThread(StunCandidateHarvest harvest)
|
||||||
{
|
{
|
||||||
this.harvest = new WeakReference<StunCandidateHarvest>(harvest);
|
this.harvest = new WeakReference<>(harvest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -51,7 +51,7 @@ public class StunCandidateHarvester
|
|||||||
* completed i.e. have harvested <tt>Candidate</tt>s.
|
* completed i.e. have harvested <tt>Candidate</tt>s.
|
||||||
*/
|
*/
|
||||||
private final List<StunCandidateHarvest> completedHarvests
|
private final List<StunCandidateHarvest> completedHarvests
|
||||||
= new LinkedList<StunCandidateHarvest>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The username used by this <tt>StunCandidateHarvester</tt> for the
|
* The username used by this <tt>StunCandidateHarvester</tt> for the
|
||||||
@ -65,7 +65,7 @@ public class StunCandidateHarvester
|
|||||||
* not completed yet so {@link #harvest(Component)} has to wait for them.
|
* not completed yet so {@link #harvest(Component)} has to wait for them.
|
||||||
*/
|
*/
|
||||||
private final List<StunCandidateHarvest> startedHarvests
|
private final List<StunCandidateHarvest> startedHarvests
|
||||||
= new LinkedList<StunCandidateHarvest>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address of the STUN server that we will be sending our requests to.
|
* The address of the STUN server that we will be sending our requests to.
|
||||||
@ -255,7 +255,7 @@ public class StunCandidateHarvester
|
|||||||
* Report the LocalCandidates gathered by this CandidateHarvester so
|
* Report the LocalCandidates gathered by this CandidateHarvester so
|
||||||
* that the harvest is sure to be considered successful.
|
* that the harvest is sure to be considered successful.
|
||||||
*/
|
*/
|
||||||
Collection<LocalCandidate> candidates = new HashSet<LocalCandidate>();
|
Collection<LocalCandidate> candidates = new HashSet<>();
|
||||||
|
|
||||||
synchronized (completedHarvests)
|
synchronized (completedHarvests)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class TcpHarvester
|
|||||||
List<NetworkInterface> interfaces)
|
List<NetworkInterface> interfaces)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
List<TransportAddress> addresses = new LinkedList<TransportAddress>();
|
List<TransportAddress> addresses = new LinkedList<>();
|
||||||
|
|
||||||
for (NetworkInterface iface : interfaces)
|
for (NetworkInterface iface : interfaces)
|
||||||
{
|
{
|
||||||
@ -126,34 +126,32 @@ public class TcpHarvester
|
|||||||
* <tt>Component</tt>s from being freed.
|
* <tt>Component</tt>s from being freed.
|
||||||
*/
|
*/
|
||||||
private final Map<String, WeakReference<Component>> components
|
private final Map<String, WeakReference<Component>> components
|
||||||
= new HashMap<String, WeakReference<Component>>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of transport addresses which we have found to be listening on,
|
* The list of transport addresses which we have found to be listening on,
|
||||||
* and which we will advertise as candidates in
|
* and which we will advertise as candidates in
|
||||||
* {@link #harvest(org.ice4j.ice.Component)}
|
* {@link #harvest(org.ice4j.ice.Component)}
|
||||||
*/
|
*/
|
||||||
private final List<TransportAddress> localAddresses
|
private final List<TransportAddress> localAddresses = new LinkedList<>();
|
||||||
= new LinkedList<TransportAddress>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a public address to a local address.
|
* Maps a public address to a local address.
|
||||||
*/
|
*/
|
||||||
private final Map<InetAddress, InetAddress> mappedAddresses
|
private final Map<InetAddress, InetAddress> mappedAddresses
|
||||||
= new HashMap<InetAddress, InetAddress>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets of additional ports, for which server reflexive candidates will be
|
* Sets of additional ports, for which server reflexive candidates will be
|
||||||
* added.
|
* added.
|
||||||
*/
|
*/
|
||||||
private final Set<Integer> mappedPorts = new HashSet<Integer>();
|
private final Set<Integer> mappedPorts = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channels pending to be added to the list that {@link #readThread} reads
|
* Channels pending to be added to the list that {@link #readThread} reads
|
||||||
* from.
|
* from.
|
||||||
*/
|
*/
|
||||||
private final List<SocketChannel> newChannels
|
private final List<SocketChannel> newChannels = new LinkedList<>();
|
||||||
= new LinkedList<SocketChannel>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A counter used to decide when to purge {@link #components}.
|
* A counter used to decide when to purge {@link #components}.
|
||||||
@ -175,7 +173,7 @@ public class TcpHarvester
|
|||||||
* on.
|
* on.
|
||||||
*/
|
*/
|
||||||
private final List<ServerSocketChannel> serverSocketChannels
|
private final List<ServerSocketChannel> serverSocketChannels
|
||||||
= new LinkedList<ServerSocketChannel>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to use ssltcp.
|
* Whether or not to use ssltcp.
|
||||||
@ -421,8 +419,7 @@ public class TcpHarvester
|
|||||||
*/
|
*/
|
||||||
private List<LocalCandidate> createLocalCandidates(Component component)
|
private List<LocalCandidate> createLocalCandidates(Component component)
|
||||||
{
|
{
|
||||||
List<TcpHostCandidate> hostCandidates
|
List<TcpHostCandidate> hostCandidates = new LinkedList<>();
|
||||||
= new LinkedList<TcpHostCandidate>();
|
|
||||||
|
|
||||||
// Add the host candidates for the addresses we really listen on
|
// Add the host candidates for the addresses we really listen on
|
||||||
for (TransportAddress transportAddress : localAddresses)
|
for (TransportAddress transportAddress : localAddresses)
|
||||||
@ -438,8 +435,7 @@ public class TcpHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add srflx candidates for any mapped addresses
|
// Add srflx candidates for any mapped addresses
|
||||||
List<LocalCandidate> mappedCandidates
|
List<LocalCandidate> mappedCandidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
for (Map.Entry<InetAddress, InetAddress> mapping
|
for (Map.Entry<InetAddress, InetAddress> mapping
|
||||||
: mappedAddresses.entrySet())
|
: mappedAddresses.entrySet())
|
||||||
@ -473,8 +469,7 @@ public class TcpHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add srflx candidates for mapped ports
|
// Add srflx candidates for mapped ports
|
||||||
List<LocalCandidate> portMappedCandidates
|
List<LocalCandidate> portMappedCandidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
for (TcpHostCandidate base : hostCandidates)
|
for (TcpHostCandidate base : hostCandidates)
|
||||||
{
|
{
|
||||||
@ -524,8 +519,7 @@ public class TcpHarvester
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList<LocalCandidate> allCandidates
|
LinkedList<LocalCandidate> allCandidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
allCandidates.addAll(hostCandidates);
|
allCandidates.addAll(hostCandidates);
|
||||||
allCandidates.addAll(mappedCandidates);
|
allCandidates.addAll(mappedCandidates);
|
||||||
@ -589,7 +583,7 @@ public class TcpHarvester
|
|||||||
*/
|
*/
|
||||||
logger.info(
|
logger.info(
|
||||||
"More than one Component for an Agent, cannot harvest.");
|
"More than one Component for an Agent, cannot harvest.");
|
||||||
return new LinkedList<LocalCandidate>();
|
return new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LocalCandidate> candidates = createLocalCandidates(component);
|
List<LocalCandidate> candidates = createLocalCandidates(component);
|
||||||
@ -599,8 +593,9 @@ public class TcpHarvester
|
|||||||
|
|
||||||
synchronized (components)
|
synchronized (components)
|
||||||
{
|
{
|
||||||
components.put(agent.getLocalUfrag(),
|
components.put(
|
||||||
new WeakReference<Component>(component));
|
agent.getLocalUfrag(),
|
||||||
|
new WeakReference<>(component));
|
||||||
purgeComponents();
|
purgeComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,8 +802,7 @@ public class TcpHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
IOException exception = null;
|
IOException exception = null;
|
||||||
List<SocketChannel> channelsToAdd
|
List<SocketChannel> channelsToAdd = new LinkedList<>();
|
||||||
= new LinkedList<SocketChannel>();
|
|
||||||
// Allow to go on, so we can quit if closed.
|
// Allow to go on, so we can quit if closed.
|
||||||
long selectTimeout = 3000;
|
long selectTimeout = 3000;
|
||||||
|
|
||||||
|
|||||||
@ -323,9 +323,7 @@ public class TurnCandidateHarvest
|
|||||||
EvenPortAttribute evenPortAttribute
|
EvenPortAttribute evenPortAttribute
|
||||||
= (EvenPortAttribute) request.getAttribute(Attribute.EVEN_PORT);
|
= (EvenPortAttribute) request.getAttribute(Attribute.EVEN_PORT);
|
||||||
boolean rFlag
|
boolean rFlag
|
||||||
= (evenPortAttribute == null)
|
= (evenPortAttribute != null) && evenPortAttribute.isRFlag();
|
||||||
? false
|
|
||||||
: evenPortAttribute.isRFlag();
|
|
||||||
|
|
||||||
return
|
return
|
||||||
MessageFactory.createAllocateRequest(
|
MessageFactory.createAllocateRequest(
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public class UPNPHarvester
|
|||||||
*/
|
*/
|
||||||
public synchronized Collection<LocalCandidate> harvest(Component component)
|
public synchronized Collection<LocalCandidate> harvest(Component component)
|
||||||
{
|
{
|
||||||
Collection<LocalCandidate> candidates = new HashSet<LocalCandidate>();
|
Collection<LocalCandidate> candidates = new HashSet<>();
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
|
|
||||||
logger.fine("Begin UPnP harvesting");
|
logger.fine("Begin UPnP harvesting");
|
||||||
@ -213,9 +213,9 @@ public class UPNPHarvester
|
|||||||
String externalIP, int port, Component cmp, GatewayDevice device)
|
String externalIP, int port, Component cmp, GatewayDevice device)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
List<LocalCandidate> ret = new ArrayList<LocalCandidate>();
|
List<LocalCandidate> ret = new ArrayList<>();
|
||||||
TransportAddress addr = new TransportAddress(externalIP, port,
|
TransportAddress addr
|
||||||
Transport.UDP);
|
= new TransportAddress(externalIP, port, Transport.UDP);
|
||||||
|
|
||||||
HostCandidate base = new HostCandidate(socket, cmp);
|
HostCandidate base = new HostCandidate(socket, cmp);
|
||||||
|
|
||||||
|
|||||||
@ -273,8 +273,8 @@ public class IceSdpUtils
|
|||||||
|
|
||||||
//m lines
|
//m lines
|
||||||
List<IceMediaStream> streams = agent.getStreams();
|
List<IceMediaStream> streams = agent.getStreams();
|
||||||
Vector<MediaDescription> mDescs = new Vector<MediaDescription>(
|
Vector<MediaDescription> mDescs
|
||||||
agent.getStreamCount());
|
= new Vector<>(agent.getStreamCount());
|
||||||
for(IceMediaStream stream : streams)
|
for(IceMediaStream stream : streams)
|
||||||
{
|
{
|
||||||
MediaDescription mLine = sdpFactory.createMediaDescription(
|
MediaDescription mLine = sdpFactory.createMediaDescription(
|
||||||
@ -320,15 +320,14 @@ public class IceSdpUtils
|
|||||||
|
|
||||||
if(localCandidates == null || localCandidates.size() == 0)
|
if(localCandidates == null || localCandidates.size() == 0)
|
||||||
{
|
{
|
||||||
trickleUpdate = new ArrayList<Attribute>(1);
|
trickleUpdate = new ArrayList<>(1);
|
||||||
trickleUpdate.add(
|
trickleUpdate.add(
|
||||||
sdpFactory.createAttribute(END_OF_CANDIDATES, null));
|
sdpFactory.createAttribute(END_OF_CANDIDATES, null));
|
||||||
|
|
||||||
return trickleUpdate;
|
return trickleUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
trickleUpdate
|
trickleUpdate = new ArrayList<>(localCandidates.size() + 1);
|
||||||
= new ArrayList<Attribute>(localCandidates.size() + 1);
|
|
||||||
|
|
||||||
String streamName = null;
|
String streamName = null;
|
||||||
|
|
||||||
|
|||||||
@ -342,7 +342,7 @@ public abstract class Message
|
|||||||
*/
|
*/
|
||||||
//not sure this is the best solution but I'm trying to keep entry order
|
//not sure this is the best solution but I'm trying to keep entry order
|
||||||
protected LinkedHashMap<Character, Attribute> attributes
|
protected LinkedHashMap<Character, Attribute> attributes
|
||||||
= new LinkedHashMap<Character, Attribute>();
|
= new LinkedHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute presentity is a thing of RFC 3489 and no longer exists in
|
* Attribute presentity is a thing of RFC 3489 and no longer exists in
|
||||||
@ -619,7 +619,7 @@ public abstract class Message
|
|||||||
{
|
{
|
||||||
synchronized(attributes)
|
synchronized(attributes)
|
||||||
{
|
{
|
||||||
return new LinkedList<Attribute>(attributes.values());
|
return new LinkedList<>(attributes.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,8 +941,7 @@ public abstract class Message
|
|||||||
offset += RFC3489_TRANSACTION_ID_LENGTH;
|
offset += RFC3489_TRANSACTION_ID_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Map.Entry<Character, Attribute>> v =
|
Vector<Map.Entry<Character, Attribute>> v = new Vector<>();
|
||||||
new Vector<Map.Entry<Character, Attribute>>();
|
|
||||||
Iterator<Map.Entry<Character, Attribute>> iter = null;
|
Iterator<Map.Entry<Character, Attribute>> iter = null;
|
||||||
char dataLengthForContentDependentAttribute = 0;
|
char dataLengthForContentDependentAttribute = 0;
|
||||||
|
|
||||||
|
|||||||
@ -36,4 +36,4 @@ enum EnShutdown
|
|||||||
* There was a forceful shutdown
|
* There was a forceful shutdown
|
||||||
*/
|
*/
|
||||||
SD_FORCEFUL
|
SD_FORCEFUL
|
||||||
};
|
}
|
||||||
|
|||||||
@ -48,4 +48,4 @@ public enum Option
|
|||||||
* Timeout in ms for write operations(0 - no timeout)
|
* Timeout in ms for write operations(0 - no timeout)
|
||||||
*/
|
*/
|
||||||
OPT_WRITE_TIMEOUT
|
OPT_WRITE_TIMEOUT
|
||||||
};
|
}
|
||||||
|
|||||||
@ -174,7 +174,7 @@ public class PseudoTCPBase
|
|||||||
* control flags. If segment contains any data it is stored in the receive
|
* control flags. If segment contains any data it is stored in the receive
|
||||||
* buffer.
|
* buffer.
|
||||||
*/
|
*/
|
||||||
List<RSegment> m_rlist = new ArrayList<RSegment>();
|
List<RSegment> m_rlist = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* Last receive timestamp
|
* Last receive timestamp
|
||||||
*/
|
*/
|
||||||
@ -203,7 +203,7 @@ public class PseudoTCPBase
|
|||||||
/**
|
/**
|
||||||
* Outgoing segments list
|
* Outgoing segments list
|
||||||
*/
|
*/
|
||||||
List<SSegment> m_slist = new ArrayList<SSegment>();
|
List<SSegment> m_slist = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* Last send timestamp
|
* Last send timestamp
|
||||||
*/
|
*/
|
||||||
@ -429,7 +429,7 @@ public class PseudoTCPBase
|
|||||||
// Check if it's time to retransmit a segment
|
// Check if it's time to retransmit a segment
|
||||||
if (m_rto_base > 0 && (timeDiff(m_rto_base + m_rx_rto, now) <= 0))
|
if (m_rto_base > 0 && (timeDiff(m_rto_base + m_rx_rto, now) <= 0))
|
||||||
{
|
{
|
||||||
assert m_slist.isEmpty() == false;
|
assert !m_slist.isEmpty();
|
||||||
// retransmit segments
|
// retransmit segments
|
||||||
if (logger.isLoggable(Level.FINER))
|
if (logger.isLoggable(Level.FINER))
|
||||||
{
|
{
|
||||||
@ -1399,7 +1399,7 @@ public class PseudoTCPBase
|
|||||||
|
|
||||||
|
|
||||||
Iterator<RSegment> iter = m_rlist.iterator();
|
Iterator<RSegment> iter = m_rlist.iterator();
|
||||||
List<RSegment> toBeRemoved = new ArrayList<RSegment>();
|
List<RSegment> toBeRemoved = new ArrayList<>();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
RSegment it = iter.next();
|
RSegment it = iter.next();
|
||||||
@ -1903,7 +1903,7 @@ public class PseudoTCPBase
|
|||||||
*/
|
*/
|
||||||
boolean parseOptions(byte[] data, int offset, int len)
|
boolean parseOptions(byte[] data, int offset, int len)
|
||||||
{
|
{
|
||||||
List<Short> options_specified = new ArrayList<Short>();
|
List<Short> options_specified = new ArrayList<>();
|
||||||
|
|
||||||
// See http://www.freesoft.org/CIE/Course/Section4/8.htm for
|
// See http://www.freesoft.org/CIE/Course/Section4/8.htm for
|
||||||
// parsing the options list.
|
// parsing the options list.
|
||||||
|
|||||||
@ -270,7 +270,7 @@ class PseudoTcpSocketImpl
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer, Object> options = new HashMap<Integer,Object>();
|
private Map<Integer, Object> options = new HashMap<>();
|
||||||
public void setOption(int optID, Object value)
|
public void setOption(int optID, Object value)
|
||||||
throws SocketException
|
throws SocketException
|
||||||
{
|
{
|
||||||
@ -353,7 +353,7 @@ class PseudoTcpSocketImpl
|
|||||||
synchronized (state_notify)
|
synchronized (state_notify)
|
||||||
{
|
{
|
||||||
while (pseudoTcp.getState() != PseudoTcpState.TCP_ESTABLISHED
|
while (pseudoTcp.getState() != PseudoTcpState.TCP_ESTABLISHED
|
||||||
&& (noTimeout ? true : (elapsed < timeout)) )
|
&& (noTimeout || (elapsed < timeout)) )
|
||||||
{
|
{
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
state_notify.wait(timeout);
|
state_notify.wait(timeout);
|
||||||
|
|||||||
@ -45,4 +45,4 @@ public enum PseudoTcpState
|
|||||||
* TODO: closing procedure
|
* TODO: closing procedure
|
||||||
*/
|
*/
|
||||||
TCP_CLOSED// = 4;
|
TCP_CLOSED// = 4;
|
||||||
};
|
}
|
||||||
|
|||||||
@ -24,5 +24,5 @@ package org.ice4j.pseudotcp;
|
|||||||
*/
|
*/
|
||||||
enum SendFlags
|
enum SendFlags
|
||||||
{
|
{
|
||||||
sfNone, sfImmediateAck, sfDelayedAck;
|
sfNone, sfImmediateAck, sfDelayedAck
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,4 +35,4 @@ public enum WriteResult
|
|||||||
* Write failed
|
* Write failed
|
||||||
*/
|
*/
|
||||||
WR_FAIL
|
WR_FAIL
|
||||||
};
|
}
|
||||||
|
|||||||
@ -41,8 +41,7 @@ public class CredentialsManager
|
|||||||
* The list of <tt>CredentialsAuthority</tt>s registered with this manager
|
* The list of <tt>CredentialsAuthority</tt>s registered with this manager
|
||||||
* as being able to provide credentials.
|
* as being able to provide credentials.
|
||||||
*/
|
*/
|
||||||
private final List<CredentialsAuthority> authorities =
|
private final List<CredentialsAuthority> authorities = new LinkedList<>();
|
||||||
new LinkedList<CredentialsAuthority>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of <tt>CredentialsAuthority</tt>s registered with this manager
|
* The list of <tt>CredentialsAuthority</tt>s registered with this manager
|
||||||
|
|||||||
@ -58,8 +58,7 @@ public class GoogleRelayedCandidateDelegate
|
|||||||
* {@link #receive(DatagramPacket)} method. They have been received from the
|
* {@link #receive(DatagramPacket)} method. They have been received from the
|
||||||
* TURN server in the form of Data indications.
|
* TURN server in the form of Data indications.
|
||||||
*/
|
*/
|
||||||
private final List<DatagramPacket> packetsToReceive =
|
private final List<DatagramPacket> packetsToReceive = new LinkedList<>();
|
||||||
new LinkedList<DatagramPacket>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>DatagramSocket</tt>s which have been sent through this
|
* The <tt>DatagramSocket</tt>s which have been sent through this
|
||||||
@ -67,8 +66,7 @@ public class GoogleRelayedCandidateDelegate
|
|||||||
* and which are to be relayed through its associated TURN server in the
|
* and which are to be relayed through its associated TURN server in the
|
||||||
* form of Send indications.
|
* form of Send indications.
|
||||||
*/
|
*/
|
||||||
private final List<DatagramPacket> packetsToSend =
|
private final List<DatagramPacket> packetsToSend = new LinkedList<>();
|
||||||
new LinkedList<DatagramPacket>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>Thread</tt> which is to send the {@link #packetsToSend} to the
|
* The <tt>Thread</tt> which is to send the {@link #packetsToSend} to the
|
||||||
@ -315,7 +313,7 @@ public class GoogleRelayedCandidateDelegate
|
|||||||
{
|
{
|
||||||
synchronized (packetsToReceive)
|
synchronized (packetsToReceive)
|
||||||
{
|
{
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* According to the javadoc of DatagramSocket#close(), any
|
* According to the javadoc of DatagramSocket#close(), any
|
||||||
@ -337,7 +335,6 @@ public class GoogleRelayedCandidateDelegate
|
|||||||
catch (InterruptedException iex)
|
catch (InterruptedException iex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -348,6 +345,7 @@ public class GoogleRelayedCandidateDelegate
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class IceTcpServerSocketWrapper
|
|||||||
/**
|
/**
|
||||||
* List of TCP client sockets.
|
* List of TCP client sockets.
|
||||||
*/
|
*/
|
||||||
private final List<Socket> sockets = new ArrayList<Socket>();
|
private final List<Socket> sockets = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>IceTcpServerSocketWrapper</tt>.
|
* Initializes a new <tt>IceTcpServerSocketWrapper</tt>.
|
||||||
|
|||||||
@ -570,7 +570,7 @@ abstract class MultiplexingXXXSocketSupport
|
|||||||
if (socketFilter.accept(p))
|
if (socketFilter.accept(p))
|
||||||
{
|
{
|
||||||
if (toMove == null)
|
if (toMove == null)
|
||||||
toMove = new LinkedList<DatagramPacket>();
|
toMove = new LinkedList<>();
|
||||||
toMove.add(p);
|
toMove.add(p);
|
||||||
|
|
||||||
// XXX In the method receive, we allow multiple filters
|
// XXX In the method receive, we allow multiple filters
|
||||||
|
|||||||
@ -112,7 +112,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
* <tt>RelayedCandidateDatagramSocket</tt>s relays data send to it to
|
* <tt>RelayedCandidateDatagramSocket</tt>s relays data send to it to
|
||||||
* peer <tt>TransportAddress</tt>es.
|
* peer <tt>TransportAddress</tt>es.
|
||||||
*/
|
*/
|
||||||
private final List<Channel> channels = new LinkedList<Channel>();
|
private final List<Channel> channels = new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The indicator which determines whether this instance has started
|
* The indicator which determines whether this instance has started
|
||||||
@ -143,8 +143,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
* {@link #receive(DatagramPacket)} method. They have been received from the
|
* {@link #receive(DatagramPacket)} method. They have been received from the
|
||||||
* TURN server in the form of Data indications.
|
* TURN server in the form of Data indications.
|
||||||
*/
|
*/
|
||||||
private final List<DatagramPacket> packetsToReceive
|
private final List<DatagramPacket> packetsToReceive = new LinkedList<>();
|
||||||
= new LinkedList<DatagramPacket>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>DatagramSocket</tt>s which have been sent through this
|
* The <tt>DatagramSocket</tt>s which have been sent through this
|
||||||
@ -152,8 +151,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
* and which are to be relayed through its associated TURN server in the
|
* and which are to be relayed through its associated TURN server in the
|
||||||
* form of Send indications.
|
* form of Send indications.
|
||||||
*/
|
*/
|
||||||
private final List<DatagramPacket> packetsToSend
|
private final List<DatagramPacket> packetsToSend = new LinkedList<>();
|
||||||
= new LinkedList<DatagramPacket>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>Thread</tt> which receives <tt>DatagramPacket</tt>s from
|
* The <tt>Thread</tt> which receives <tt>DatagramPacket</tt>s from
|
||||||
@ -704,7 +702,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
{
|
{
|
||||||
synchronized (packetsToReceive)
|
synchronized (packetsToReceive)
|
||||||
{
|
{
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* According to the javadoc of DatagramSocket#close(), any
|
* According to the javadoc of DatagramSocket#close(), any
|
||||||
@ -728,7 +726,6 @@ public class RelayedCandidateDatagramSocket
|
|||||||
catch (InterruptedException iex)
|
catch (InterruptedException iex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -739,6 +736,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class RtcpDemuxPacketFilter
|
|||||||
byte[] data = p.getData();
|
byte[] data = p.getData();
|
||||||
int off = p.getOffset();
|
int off = p.getOffset();
|
||||||
|
|
||||||
if (((data[off + 0] & 0xc0) >> 6) == 2) //RTP/RTCP version field
|
if (((data[off] & 0xc0) >> 6) == 2) //RTP/RTCP version field
|
||||||
{
|
{
|
||||||
int pt = data[off + 1] & 0xff;
|
int pt = data[off + 1] & 0xff;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class EventDispatcher
|
|||||||
* <tt>EventDispatcher</tt>.
|
* <tt>EventDispatcher</tt>.
|
||||||
*/
|
*/
|
||||||
private final List<MessageTypeEventHandler<?>> messageListeners
|
private final List<MessageTypeEventHandler<?>> messageListeners
|
||||||
= new Vector<MessageTypeEventHandler<?>>();
|
= new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>Map</tt> of <tt>EventDispatcher</tt>s which keep the
|
* The <tt>Map</tt> of <tt>EventDispatcher</tt>s which keep the
|
||||||
@ -48,7 +48,7 @@ public class EventDispatcher
|
|||||||
* <tt>TransportAddress<tt>es.
|
* <tt>TransportAddress<tt>es.
|
||||||
*/
|
*/
|
||||||
private final Map<TransportAddress, EventDispatcher> children
|
private final Map<TransportAddress, EventDispatcher> children
|
||||||
= new Hashtable<TransportAddress, EventDispatcher>();
|
= new Hashtable<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>EventDispatcher</tt> instance.
|
* Initializes a new <tt>EventDispatcher</tt> instance.
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class MessageQueue
|
|||||||
|
|
||||||
// not sure whether Vector is the best choice here since we explicitly
|
// not sure whether Vector is the best choice here since we explicitly
|
||||||
//sync all methods ... review later
|
//sync all methods ... review later
|
||||||
private Vector<RawMessage> queue = new Vector<RawMessage>();
|
private final Vector<RawMessage> queue = new Vector<>();
|
||||||
|
|
||||||
//keep a copy of the fifo size and make it accessible for concurrent
|
//keep a copy of the fifo size and make it accessible for concurrent
|
||||||
// queries.
|
// queries.
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class NetAccessManager
|
|||||||
*/
|
*/
|
||||||
private final Map<TransportAddress, Map<TransportAddress, Connector>>
|
private final Map<TransportAddress, Map<TransportAddress, Connector>>
|
||||||
udpConnectors
|
udpConnectors
|
||||||
= new HashMap<TransportAddress, Map<TransportAddress, Connector>>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All <tt>Connectors</tt> currently in use with TCP. The table maps a local
|
* All <tt>Connectors</tt> currently in use with TCP. The table maps a local
|
||||||
@ -74,7 +74,7 @@ class NetAccessManager
|
|||||||
*/
|
*/
|
||||||
private final Map<TransportAddress, Map<TransportAddress, Connector>>
|
private final Map<TransportAddress, Map<TransportAddress, Connector>>
|
||||||
tcpConnectors
|
tcpConnectors
|
||||||
= new HashMap<TransportAddress, Map<TransportAddress, Connector>>();
|
= new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A synchronized FIFO where incoming messages are stocked for processing.
|
* A synchronized FIFO where incoming messages are stocked for processing.
|
||||||
@ -84,8 +84,7 @@ class NetAccessManager
|
|||||||
/**
|
/**
|
||||||
* A thread pool of message processors.
|
* A thread pool of message processors.
|
||||||
*/
|
*/
|
||||||
private Vector<MessageProcessor> messageProcessors
|
private final Vector<MessageProcessor> messageProcessors = new Vector<>();
|
||||||
= new Vector<MessageProcessor>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The instance that should be notified when an incoming message has been
|
* The instance that should be notified when an incoming message has been
|
||||||
@ -332,8 +331,7 @@ class NetAccessManager
|
|||||||
|
|
||||||
if (connectorsForLocalAddress == null)
|
if (connectorsForLocalAddress == null)
|
||||||
{
|
{
|
||||||
connectorsForLocalAddress
|
connectorsForLocalAddress = new HashMap<>();
|
||||||
= new HashMap<TransportAddress, Connector>();
|
|
||||||
connectorsMap.put(localAddress, connectorsForLocalAddress);
|
connectorsMap.put(localAddress, connectorsForLocalAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public class StunStack
|
|||||||
*/
|
*/
|
||||||
private final Hashtable<TransactionID, StunClientTransaction>
|
private final Hashtable<TransactionID, StunClientTransaction>
|
||||||
clientTransactions
|
clientTransactions
|
||||||
= new Hashtable<TransactionID, StunClientTransaction>();
|
= new Hashtable<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>Thread</tt> which expires the <tt>StunServerTransaction</tt>s of
|
* The <tt>Thread</tt> which expires the <tt>StunServerTransaction</tt>s of
|
||||||
@ -96,7 +96,7 @@ public class StunStack
|
|||||||
*/
|
*/
|
||||||
private final Hashtable<TransactionID, StunServerTransaction>
|
private final Hashtable<TransactionID, StunServerTransaction>
|
||||||
serverTransactions
|
serverTransactions
|
||||||
= new Hashtable<TransactionID, StunServerTransaction>();
|
= new Hashtable<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dispatcher for incoming requests event;
|
* A dispatcher for incoming requests event;
|
||||||
@ -310,8 +310,7 @@ public class StunStack
|
|||||||
*/
|
*/
|
||||||
if (clientTransactionsToCancel == null)
|
if (clientTransactionsToCancel == null)
|
||||||
{
|
{
|
||||||
clientTransactionsToCancel
|
clientTransactionsToCancel = new LinkedList<>();
|
||||||
= new LinkedList<StunClientTransaction>();
|
|
||||||
}
|
}
|
||||||
clientTransactionsToCancel.add(tran);
|
clientTransactionsToCancel.add(tran);
|
||||||
}
|
}
|
||||||
@ -352,8 +351,7 @@ public class StunStack
|
|||||||
|
|
||||||
if (serverTransactionsToExpire == null)
|
if (serverTransactionsToExpire == null)
|
||||||
{
|
{
|
||||||
serverTransactionsToExpire
|
serverTransactionsToExpire = new LinkedList<>();
|
||||||
= new LinkedList<StunServerTransaction>();
|
|
||||||
}
|
}
|
||||||
serverTransactionsToExpire.add(tran);
|
serverTransactionsToExpire.add(tran);
|
||||||
}
|
}
|
||||||
@ -1079,8 +1077,7 @@ public class StunStack
|
|||||||
synchronized (clientTransactions)
|
synchronized (clientTransactions)
|
||||||
{
|
{
|
||||||
clientTransactionsToCancel
|
clientTransactionsToCancel
|
||||||
= new ArrayList<StunClientTransaction>(
|
= new ArrayList<>(clientTransactions.values());
|
||||||
clientTransactions.values());
|
|
||||||
clientTransactions.clear();
|
clientTransactions.clear();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -1097,8 +1094,7 @@ public class StunStack
|
|||||||
synchronized (serverTransactions)
|
synchronized (serverTransactions)
|
||||||
{
|
{
|
||||||
serverTransactionsToExpire
|
serverTransactionsToExpire
|
||||||
= new ArrayList<StunServerTransaction>(
|
= new ArrayList<>(serverTransactions.values());
|
||||||
serverTransactions.values());
|
|
||||||
serverTransactions.clear();
|
serverTransactions.clear();
|
||||||
}
|
}
|
||||||
for (StunServerTransaction tran : serverTransactionsToExpire)
|
for (StunServerTransaction tran : serverTransactionsToExpire)
|
||||||
|
|||||||
@ -131,8 +131,8 @@ public class TransactionID
|
|||||||
|
|
||||||
for(int i = 0; i < b; i++)
|
for(int i = 0; i < b; i++)
|
||||||
{
|
{
|
||||||
tid.transactionID[i] = (byte)((left >> (i * 8)) & 0xFFl);
|
tid.transactionID[i] = (byte)((left >> (i * 8)) & 0xFFL);
|
||||||
tid.transactionID[i + b] = (byte)((right >> (i * 8)) & 0xFFl);
|
tid.transactionID[i + b] = (byte)((right >> (i * 8)) & 0xFFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate hashcode for Hashtable storage.
|
//calculate hashcode for Hashtable storage.
|
||||||
|
|||||||
@ -260,8 +260,7 @@ public class MessageEventDispatchingTest extends TestCase
|
|||||||
private class PlainRequestCollector implements RequestListener
|
private class PlainRequestCollector implements RequestListener
|
||||||
{
|
{
|
||||||
/** all requests we've received so far. */
|
/** all requests we've received so far. */
|
||||||
public Vector<StunMessageEvent> receivedRequests
|
public final Vector<StunMessageEvent> receivedRequests = new Vector<>();
|
||||||
= new Vector<StunMessageEvent>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores incoming requests.
|
* Stores incoming requests.
|
||||||
@ -299,7 +298,7 @@ public class MessageEventDispatchingTest extends TestCase
|
|||||||
private static class PlainResponseCollector
|
private static class PlainResponseCollector
|
||||||
extends AbstractResponseCollector
|
extends AbstractResponseCollector
|
||||||
{
|
{
|
||||||
public final Vector<Object> receivedResponses = new Vector<Object>();
|
public final Vector<Object> receivedResponses = new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies this <tt>ResponseCollector</tt> that a transaction described by
|
* Notifies this <tt>ResponseCollector</tt> that a transaction described by
|
||||||
|
|||||||
@ -515,7 +515,7 @@ public class TransactionSupportTests extends TestCase
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private Vector<StunMessageEvent> receivedRequestsVector
|
private Vector<StunMessageEvent> receivedRequestsVector
|
||||||
= new Vector<StunMessageEvent>();
|
= new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the newly received request.
|
* Logs the newly received request.
|
||||||
@ -543,7 +543,7 @@ public class TransactionSupportTests extends TestCase
|
|||||||
*/
|
*/
|
||||||
public Vector<StunMessageEvent> getRequestsForTransaction(byte[] tranid)
|
public Vector<StunMessageEvent> getRequestsForTransaction(byte[] tranid)
|
||||||
{
|
{
|
||||||
Vector<StunMessageEvent> newVec = new Vector<StunMessageEvent>();
|
Vector<StunMessageEvent> newVec = new Vector<>();
|
||||||
|
|
||||||
for (StunMessageEvent evt : receivedRequestsVector)
|
for (StunMessageEvent evt : receivedRequestsVector)
|
||||||
{
|
{
|
||||||
@ -581,7 +581,7 @@ public class TransactionSupportTests extends TestCase
|
|||||||
/**
|
/**
|
||||||
* The responses we've collected so far.
|
* The responses we've collected so far.
|
||||||
*/
|
*/
|
||||||
public final Vector<Object> receivedResponses = new Vector<Object>();
|
public final Vector<Object> receivedResponses = new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies this <tt>ResponseCollector</tt> that a transaction described by
|
* Notifies this <tt>ResponseCollector</tt> that a transaction described by
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class OptionalAttributeAttributeTest extends TestCase
|
|||||||
assertEquals("failed null comparison", expectedReturn, actualReturn);
|
assertEquals("failed null comparison", expectedReturn, actualReturn);
|
||||||
|
|
||||||
//wrong type comparison
|
//wrong type comparison
|
||||||
obj = new String("hehe :)");
|
obj = "hehe :)";
|
||||||
actualReturn = optionalAttribute.equals(obj);
|
actualReturn = optionalAttribute.equals(obj);
|
||||||
assertEquals("failed wrong type comparison", expectedReturn,
|
assertEquals("failed wrong type comparison", expectedReturn,
|
||||||
actualReturn);
|
actualReturn);
|
||||||
|
|||||||
@ -253,8 +253,8 @@ public class UnknownAttributesAttributeTest extends TestCase
|
|||||||
|
|
||||||
Iterator<Character> iterator = unknownAttributesAttribute.getAttributes();
|
Iterator<Character> iterator = unknownAttributesAttribute.getAttributes();
|
||||||
|
|
||||||
actualId1 = iterator.next().charValue();
|
actualId1 = iterator.next();
|
||||||
actualId2 = iterator.next().charValue();;
|
actualId2 = iterator.next();
|
||||||
|
|
||||||
assertEquals("getAttributes() return value mismatch", expectedId1, actualId1);
|
assertEquals("getAttributes() return value mismatch", expectedId1, actualId1);
|
||||||
assertEquals("getAttributes() return value mismatch", expectedId2, actualId2);
|
assertEquals("getAttributes() return value mismatch", expectedId2, actualId2);
|
||||||
|
|||||||
@ -67,8 +67,8 @@ public class PseudoTcpTestRecvWindow extends PseudoTcpTestBase
|
|||||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||||
testDataSize = size;
|
testDataSize = size;
|
||||||
long start, elapsed;
|
long start, elapsed;
|
||||||
send_position = new ArrayList<Integer>();
|
send_position = new ArrayList<>();
|
||||||
recv_position = new ArrayList<Integer>();
|
recv_position = new ArrayList<>();
|
||||||
// Create some dummy data
|
// Create some dummy data
|
||||||
byte[] dummy = createDummyData(size);
|
byte[] dummy = createDummyData(size);
|
||||||
send_stream = new ByteFifoBuffer(size);
|
send_stream = new ByteFifoBuffer(size);
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class ResponseSequenceServer
|
|||||||
/**
|
/**
|
||||||
* The sequence of responses to send.
|
* The sequence of responses to send.
|
||||||
*/
|
*/
|
||||||
private Vector<Object> messageSequence = new Vector<Object>();
|
private Vector<Object> messageSequence = new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>StunStack</tt> used by this instance for the purposes of STUN
|
* The <tt>StunStack</tt> used by this instance for the purposes of STUN
|
||||||
@ -110,7 +110,7 @@ public class ResponseSequenceServer
|
|||||||
if (response == null)
|
if (response == null)
|
||||||
{
|
{
|
||||||
//leave a mark to skip a message
|
//leave a mark to skip a message
|
||||||
messageSequence.add(new Boolean(false));
|
messageSequence.add(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
messageSequence.add(response);
|
messageSequence.add(response);
|
||||||
|
|||||||
@ -60,8 +60,7 @@ public class AwsTest
|
|||||||
}
|
}
|
||||||
AwsCandidateHarvester mch = new AwsCandidateHarvester();
|
AwsCandidateHarvester mch = new AwsCandidateHarvester();
|
||||||
|
|
||||||
List<CandidateHarvester> harvesters
|
List<CandidateHarvester> harvesters = new ArrayList<>();
|
||||||
= new ArrayList<CandidateHarvester>();
|
|
||||||
harvesters.add(mch);
|
harvesters.add(mch);
|
||||||
|
|
||||||
Agent localAgent = createAgent(2020, false, harvesters);
|
Agent localAgent = createAgent(2020, false, harvesters);
|
||||||
|
|||||||
@ -97,7 +97,7 @@ public class IceDistributed
|
|||||||
= new BufferedReader(new InputStreamReader(System.in));
|
= new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
|
||||||
StringBuffer buff = new StringBuffer();
|
StringBuffer buff = new StringBuffer();
|
||||||
String line = new String();
|
String line;
|
||||||
|
|
||||||
while ( (line = reader.readLine()) != null)
|
while ( (line = reader.readLine()) != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,8 +78,7 @@ public class MappingTest
|
|||||||
MappingCandidateHarvester natHarvester
|
MappingCandidateHarvester natHarvester
|
||||||
= new MappingCandidateHarvester(publicAddress, localAddress);
|
= new MappingCandidateHarvester(publicAddress, localAddress);
|
||||||
|
|
||||||
List<CandidateHarvester> harvesters
|
List<CandidateHarvester> harvesters = new ArrayList<>();
|
||||||
= new ArrayList<CandidateHarvester>();
|
|
||||||
harvesters.add(natHarvester);
|
harvesters.add(natHarvester);
|
||||||
|
|
||||||
Agent localAgent = createAgent(2020, false, harvesters);
|
Agent localAgent = createAgent(2020, false, harvesters);
|
||||||
|
|||||||
@ -18,13 +18,11 @@
|
|||||||
package test;
|
package test;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import javax.sdp.*;
|
import javax.sdp.*;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.*;
|
import org.ice4j.ice.*;
|
||||||
import org.ice4j.ice.Agent;
|
|
||||||
import org.ice4j.ice.sdp.*;
|
import org.ice4j.ice.sdp.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class TrickleIce
|
|||||||
localAgent.startCandidateTrickle(printer);
|
localAgent.startCandidateTrickle(printer);
|
||||||
|
|
||||||
|
|
||||||
List<Component> allComponents = new LinkedList<Component>();
|
List<Component> allComponents = new LinkedList<>();
|
||||||
int allCandidates = 0;
|
int allCandidates = 0;
|
||||||
for (IceMediaStream stream : localAgent.getStreams())
|
for (IceMediaStream stream : localAgent.getStreams())
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ public class TrickleIce
|
|||||||
|
|
||||||
if(iceCandidates == null)
|
if(iceCandidates == null)
|
||||||
{
|
{
|
||||||
try{Thread.sleep(1000);}catch(Exception e){};
|
try{Thread.sleep(1000);}catch(Exception e){}
|
||||||
|
|
||||||
logger.info("ICE stats: time="
|
logger.info("ICE stats: time="
|
||||||
+ agent.getTotalHarvestingTime() + "ms");
|
+ agent.getTotalHarvestingTime() + "ms");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user