style: Whitespace and braces.
This commit is contained in:
parent
abec6b79e5
commit
a1796c9bfb
@ -554,7 +554,7 @@ public class Agent
|
||||
logger.warning("Failed to gather any host candidates!");
|
||||
|
||||
//in case we are not trickling, apply other harvesters here
|
||||
if(!isTrickling())
|
||||
if (!isTrickling())
|
||||
{
|
||||
harvestingStarted = true; //raise a flag to warn on a second call.
|
||||
harvesters.harvest(component);
|
||||
@ -588,13 +588,13 @@ public class Agent
|
||||
public void startCandidateTrickle(TrickleCallback trickleCallback)
|
||||
throws IllegalStateException
|
||||
{
|
||||
if(!isTrickling())
|
||||
if (!isTrickling())
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"Trying to start trickling without enabling it on the agent!");
|
||||
}
|
||||
|
||||
if(harvestingStarted)
|
||||
if (harvestingStarted)
|
||||
{
|
||||
logger.warning(
|
||||
"Hmmm ... why are you harvesting twice? You shouldn't be!");
|
||||
@ -642,7 +642,7 @@ public class Agent
|
||||
|
||||
//if we have received connectivity checks before RUNNING state,
|
||||
//trigger a check for those candidate pairs.
|
||||
if(this.preDiscoveredPairsQueue.size() > 0)
|
||||
if (this.preDiscoveredPairsQueue.size() > 0)
|
||||
{
|
||||
logger.info(
|
||||
"Trigger checks for pairs that were received before "
|
||||
@ -863,7 +863,7 @@ public class Agent
|
||||
? 0
|
||||
: maxCheckListSize / streamCount;
|
||||
|
||||
for(IceMediaStream stream : streams)
|
||||
for (IceMediaStream stream : streams)
|
||||
{
|
||||
logger.info("Init checklist for stream " + stream.getName());
|
||||
stream.setMaxCheckListSize(maxPerStreamSize);
|
||||
@ -1252,8 +1252,10 @@ public class Agent
|
||||
buff.append(" tie-breaker:").append(getTieBreaker());
|
||||
buff.append("):\n");
|
||||
|
||||
for(IceMediaStream stream : getStreams())
|
||||
for (IceMediaStream stream : getStreams())
|
||||
{
|
||||
buff.append(stream).append("\n");
|
||||
}
|
||||
|
||||
return buff.toString();
|
||||
}
|
||||
@ -1282,12 +1284,14 @@ public class Agent
|
||||
|
||||
//in case we have already initialized our check lists we'd need to
|
||||
//recompute pair priorities.
|
||||
for(IceMediaStream stream : getStreams())
|
||||
for (IceMediaStream stream : getStreams())
|
||||
{
|
||||
CheckList list = stream.getCheckList();
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
list.recomputePairPriorities();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1338,12 +1342,14 @@ public class Agent
|
||||
*/
|
||||
public LocalCandidate findLocalCandidate(TransportAddress localAddress)
|
||||
{
|
||||
for(IceMediaStream stream : mediaStreams.values())
|
||||
for (IceMediaStream stream : mediaStreams.values())
|
||||
{
|
||||
LocalCandidate cnd = stream.findLocalCandidate(localAddress);
|
||||
|
||||
if(cnd != null)
|
||||
if (cnd != null)
|
||||
{
|
||||
return cnd;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1363,13 +1369,13 @@ public class Agent
|
||||
TransportAddress localAddress,
|
||||
String ufrag)
|
||||
{
|
||||
for(IceMediaStream stream : mediaStreams.values())
|
||||
for (IceMediaStream stream : mediaStreams.values())
|
||||
{
|
||||
for(Component c : stream.getComponents())
|
||||
for (Component c : stream.getComponents())
|
||||
{
|
||||
for(LocalCandidate cnd : c.getLocalCandidates())
|
||||
for (LocalCandidate cnd : c.getLocalCandidates())
|
||||
{
|
||||
if(cnd != null
|
||||
if (cnd != null
|
||||
&& cnd.getUfrag() != null
|
||||
&& cnd.getUfrag().equals(ufrag))
|
||||
{
|
||||
@ -1394,12 +1400,14 @@ public class Agent
|
||||
*/
|
||||
public RemoteCandidate findRemoteCandidate(TransportAddress remoteAddress)
|
||||
{
|
||||
for(IceMediaStream stream : mediaStreams.values())
|
||||
for (IceMediaStream stream : mediaStreams.values())
|
||||
{
|
||||
RemoteCandidate cnd = stream.findRemoteCandidate(remoteAddress);
|
||||
|
||||
if(cnd != null)
|
||||
if (cnd != null)
|
||||
{
|
||||
return cnd;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1503,7 +1511,7 @@ public class Agent
|
||||
|
||||
localCandidate = findLocalCandidate(localAddress);
|
||||
|
||||
if(localCandidate == null)
|
||||
if (localCandidate == null)
|
||||
{
|
||||
logger.info("No localAddress for this incoming checks: " +
|
||||
localAddress);
|
||||
@ -1529,18 +1537,18 @@ public class Agent
|
||||
|
||||
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
||||
triggeredPair.toShortString());
|
||||
if(useCandidate)
|
||||
if (useCandidate)
|
||||
{
|
||||
triggeredPair.setUseCandidateReceived();
|
||||
}
|
||||
|
||||
synchronized(startLock)
|
||||
{
|
||||
if(isStarted())
|
||||
if (isStarted())
|
||||
{
|
||||
//we are started, which means we have the remote candidates
|
||||
//so it's now safe to go and see whether this is a new PR cand.
|
||||
if(triggeredPair.getParentComponent().getSelectedPair() == null)
|
||||
if (triggeredPair.getParentComponent().getSelectedPair() == null)
|
||||
{
|
||||
logger.info("Received check from "
|
||||
+ triggeredPair.toShortString() + " triggered a check. "
|
||||
@ -1637,7 +1645,7 @@ public class Agent
|
||||
// Its state is set to Waiting [and it] is enqueued into the
|
||||
// triggered check queue.
|
||||
//
|
||||
if(triggerPair.getParentComponent().getSelectedPair() == null)
|
||||
if (triggerPair.getParentComponent().getSelectedPair() == null)
|
||||
logger.info("Add peer CandidatePair with new reflexive " +
|
||||
"address to checkList: " + triggerPair);
|
||||
parentStream.addToCheckList(triggerPair);
|
||||
@ -1696,7 +1704,7 @@ public class Agent
|
||||
public synchronized void nominate(CandidatePair pair)
|
||||
throws IllegalStateException
|
||||
{
|
||||
if(!isControlling())
|
||||
if (!isControlling())
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"Only controlling agents can nominate pairs");
|
||||
@ -1745,13 +1753,15 @@ public class Agent
|
||||
IceMediaStream parentStream = parentComponent.getParentStream();
|
||||
CheckList checkList = parentStream.getCheckList();
|
||||
|
||||
if( checkList.getState() == CheckListState.RUNNING )
|
||||
if ( checkList.getState() == CheckListState.RUNNING )
|
||||
{
|
||||
checkList.handleNominationConfirmed(nominatedPair);
|
||||
}
|
||||
|
||||
//Once there is at least one nominated pair in the valid list for
|
||||
//every component of the media stream and the state of the
|
||||
//check list is Running
|
||||
if(parentStream.allComponentsHaveSelected()
|
||||
if (parentStream.allComponentsHaveSelected()
|
||||
&& checkList.getState() == CheckListState.RUNNING)
|
||||
{
|
||||
//The agent MUST change the state of processing for its check
|
||||
@ -1770,21 +1780,23 @@ public class Agent
|
||||
boolean allListsEnded = true;
|
||||
boolean atLeastOneListSucceeded = false;
|
||||
|
||||
if(getState().isEstablished())
|
||||
if (getState().isEstablished())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<IceMediaStream> streams = getStreams();
|
||||
|
||||
for(IceMediaStream stream : streams)
|
||||
for (IceMediaStream stream : streams)
|
||||
{
|
||||
CheckListState checkListState = stream.getCheckList().getState();
|
||||
|
||||
if(checkListState == CheckListState.RUNNING)
|
||||
if (checkListState == CheckListState.RUNNING)
|
||||
{
|
||||
allListsEnded = false;
|
||||
break;
|
||||
}
|
||||
else if(checkListState == CheckListState.COMPLETED)
|
||||
else if (checkListState == CheckListState.COMPLETED)
|
||||
{
|
||||
logger.info("CheckList of stream " + stream.getName() +
|
||||
" is COMPLETED");
|
||||
@ -1793,10 +1805,12 @@ public class Agent
|
||||
}
|
||||
|
||||
|
||||
if(!allListsEnded)
|
||||
if (!allListsEnded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!atLeastOneListSucceeded)
|
||||
if (!atLeastOneListSucceeded)
|
||||
{
|
||||
//all lists ended but none succeeded. No love today ;(
|
||||
if (logger.isLoggable(Level.INFO))
|
||||
@ -1817,7 +1831,7 @@ public class Agent
|
||||
|
||||
//Once the state of each check list is Completed:
|
||||
//The agent sets the state of ICE processing overall to Completed.
|
||||
if(getState() != IceProcessingState.RUNNING)
|
||||
if (getState() != IceProcessingState.RUNNING)
|
||||
{
|
||||
//Oh, seems like we already did this.
|
||||
return;
|
||||
@ -1827,7 +1841,9 @@ public class Agent
|
||||
// under our nose here has been observed (and not in a single instance)
|
||||
// So check that we did indeed just trigger the change.
|
||||
if (!setState(IceProcessingState.COMPLETED))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// keep ICE running (answer STUN Binding requests, send STUN Binding
|
||||
// indications or requests)
|
||||
@ -1855,9 +1871,9 @@ public class Agent
|
||||
{
|
||||
List<IceMediaStream> strms = getStreams();
|
||||
|
||||
for(IceMediaStream stream : strms)
|
||||
for (IceMediaStream stream : strms)
|
||||
{
|
||||
for(Component component : stream.getComponents())
|
||||
for (Component component : stream.getComponents())
|
||||
{
|
||||
CandidatePair selectedPair = component.getSelectedPair();
|
||||
|
||||
@ -1867,7 +1883,7 @@ public class Agent
|
||||
buf.append(" (local ufrag ").append(getLocalUfrag());
|
||||
buf.append("): ");
|
||||
|
||||
if(selectedPair == null)
|
||||
if (selectedPair == null)
|
||||
{
|
||||
buf.append("none (conn checks failed)");
|
||||
logger.info(buf.toString());
|
||||
@ -1880,7 +1896,7 @@ public class Agent
|
||||
|
||||
buf.append(localCnd.getType());
|
||||
|
||||
if(serverAddr != null)
|
||||
if (serverAddr != null)
|
||||
{
|
||||
buf.append(" (STUN server = ");
|
||||
buf.append(serverAddr);
|
||||
@ -1891,7 +1907,7 @@ public class Agent
|
||||
TransportAddress relayAddr
|
||||
= localCnd.getRelayServerAddress();
|
||||
|
||||
if(relayAddr != null)
|
||||
if (relayAddr != null)
|
||||
{
|
||||
buf.append(" (relay = ");
|
||||
buf.append(relayAddr);
|
||||
@ -1916,8 +1932,10 @@ public class Agent
|
||||
{
|
||||
Collection<IceMediaStream> streamsCol = mediaStreams.values();
|
||||
|
||||
for( IceMediaStream stream : streamsCol)
|
||||
for (IceMediaStream stream : streamsCol)
|
||||
{
|
||||
num += stream.countHostCandidates();
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
@ -2276,9 +2294,9 @@ public class Agent
|
||||
|
||||
while (runInStunKeepAliveThreadCondition())
|
||||
{
|
||||
for(IceMediaStream stream : getStreams())
|
||||
for (IceMediaStream stream : getStreams())
|
||||
{
|
||||
for(Component component : stream.getComponents())
|
||||
for (Component component : stream.getComponents())
|
||||
{
|
||||
for (CandidatePair pair : component.getKeepAlivePairs())
|
||||
{
|
||||
@ -2304,7 +2322,9 @@ public class Agent
|
||||
}
|
||||
|
||||
if (!runInStunKeepAliveThreadCondition())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -2430,15 +2450,15 @@ public class Agent
|
||||
{
|
||||
long harvestingTime = 0;
|
||||
|
||||
for(CandidateHarvester harvester : harvesters)
|
||||
for (CandidateHarvester harvester : harvesters)
|
||||
{
|
||||
if(harvester.getClass().getName().endsWith(harvesterName))
|
||||
if (harvester.getClass().getName().endsWith(harvesterName))
|
||||
{
|
||||
harvestingTime
|
||||
= harvester.getHarvestStatistics().getHarvestDuration();
|
||||
// There may be several harvester with the same class name.
|
||||
// Thus, returns only an active one (if any).
|
||||
if(harvestingTime != 0)
|
||||
if (harvestingTime != 0)
|
||||
{
|
||||
return harvestingTime;
|
||||
}
|
||||
@ -2462,15 +2482,15 @@ public class Agent
|
||||
{
|
||||
int harvestCount;
|
||||
|
||||
for(CandidateHarvester harvester : harvesters)
|
||||
for (CandidateHarvester harvester : harvesters)
|
||||
{
|
||||
if(harvester.getClass().getName().endsWith(harvesterName))
|
||||
if (harvester.getClass().getName().endsWith(harvesterName))
|
||||
{
|
||||
harvestCount
|
||||
= harvester.getHarvestStatistics().getHarvestCount();
|
||||
// There may be several harvester with the same class name.
|
||||
// Thus, returns only an active one (if any).
|
||||
if(harvestCount != 0)
|
||||
if (harvestCount != 0)
|
||||
{
|
||||
return harvestCount;
|
||||
}
|
||||
@ -2489,7 +2509,7 @@ public class Agent
|
||||
{
|
||||
long harvestDuration = 0;
|
||||
|
||||
for(CandidateHarvester harvester : harvesters)
|
||||
for (CandidateHarvester harvester : harvesters)
|
||||
{
|
||||
harvestDuration
|
||||
+= harvester.getHarvestStatistics().getHarvestDuration();
|
||||
@ -2510,7 +2530,7 @@ public class Agent
|
||||
{
|
||||
int harvestCount = 0;
|
||||
|
||||
for(CandidateHarvester harvester : harvesters)
|
||||
for (CandidateHarvester harvester : harvesters)
|
||||
{
|
||||
harvestCount += harvester.getHarvestStatistics().getHarvestCount();
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ public class Component
|
||||
synchronized(localCandidates)
|
||||
{
|
||||
int count = 0;
|
||||
for(Candidate<?> cand : localCandidates)
|
||||
for (Candidate<?> cand : localCandidates)
|
||||
{
|
||||
if ((cand.getType() == CandidateType.HOST_CANDIDATE)
|
||||
&& !cand.isVirtual())
|
||||
@ -361,7 +361,7 @@ public class Component
|
||||
|
||||
synchronized(remoteUpdateCandidates)
|
||||
{
|
||||
if(remoteUpdateCandidates.size() == 0)
|
||||
if (remoteUpdateCandidates.size() == 0)
|
||||
return;
|
||||
|
||||
newRemoteCandidates = new LinkedList<>(remoteUpdateCandidates);
|
||||
@ -370,9 +370,9 @@ public class Component
|
||||
|
||||
// remove UPnP base from local candidate
|
||||
LocalCandidate upnpBase = null;
|
||||
for(LocalCandidate lc : localCnds)
|
||||
for (LocalCandidate lc : localCnds)
|
||||
{
|
||||
if(lc instanceof UPNPCandidate)
|
||||
if (lc instanceof UPNPCandidate)
|
||||
{
|
||||
upnpBase = lc.getBase();
|
||||
}
|
||||
@ -380,26 +380,26 @@ public class Component
|
||||
|
||||
checkList = new Vector<>();
|
||||
|
||||
for(LocalCandidate localCnd : localCnds)
|
||||
for (LocalCandidate localCnd : localCnds)
|
||||
{
|
||||
if(localCnd == upnpBase)
|
||||
if (localCnd == upnpBase)
|
||||
continue;
|
||||
|
||||
//pair each of the new remote candidates with each of our locals
|
||||
for(RemoteCandidate remoteCnd : remoteUpdateCandidates)
|
||||
for (RemoteCandidate remoteCnd : remoteUpdateCandidates)
|
||||
{
|
||||
if(localCnd.canReach(remoteCnd)
|
||||
if (localCnd.canReach(remoteCnd)
|
||||
&& remoteCnd.getTransportAddress().getPort() != 0)
|
||||
{
|
||||
// A single LocalCandidate might be/become connected
|
||||
// to more more than one remote address, and that's ok
|
||||
// (that is, we need to form pairs with them all).
|
||||
/*
|
||||
if(localCnd.getTransport() == Transport.TCP &&
|
||||
if (localCnd.getTransport() == Transport.TCP &&
|
||||
localCnd.getIceSocketWrapper().getTCPSocket().
|
||||
isConnected())
|
||||
{
|
||||
if(!localCnd.getIceSocketWrapper().getTCPSocket().
|
||||
if (!localCnd.getIceSocketWrapper().getTCPSocket().
|
||||
getRemoteSocketAddress().equals(
|
||||
remoteCnd.getTransportAddress()))
|
||||
{
|
||||
@ -431,7 +431,7 @@ public class Component
|
||||
Collections.sort(checkList, CandidatePair.comparator);
|
||||
parentStream.pruneCheckList(checkList);
|
||||
|
||||
if(parentStream.getCheckList().getState().equals(
|
||||
if (parentStream.getCheckList().getState().equals(
|
||||
CheckListState.RUNNING))
|
||||
{
|
||||
//add the updated CandidatePair list to the currently running
|
||||
@ -439,7 +439,7 @@ public class Component
|
||||
CheckList streamCheckList = parentStream.getCheckList();
|
||||
synchronized(streamCheckList)
|
||||
{
|
||||
for(CandidatePair pair : checkList)
|
||||
for (CandidatePair pair : checkList)
|
||||
{
|
||||
streamCheckList.add(pair);
|
||||
}
|
||||
@ -531,7 +531,7 @@ public class Component
|
||||
//local candidates
|
||||
int localCandidatesCount = getLocalCandidateCount();
|
||||
|
||||
if(localCandidatesCount > 0)
|
||||
if (localCandidatesCount > 0)
|
||||
{
|
||||
buff.append("\n")
|
||||
.append(localCandidatesCount)
|
||||
@ -554,7 +554,7 @@ public class Component
|
||||
//remote candidates
|
||||
int remoteCandidatesCount = getRemoteCandidateCount();
|
||||
|
||||
if(remoteCandidatesCount > 0)
|
||||
if (remoteCandidatesCount > 0)
|
||||
{
|
||||
buff.append("\n")
|
||||
.append(remoteCandidatesCount)
|
||||
@ -663,7 +663,7 @@ public class Component
|
||||
&& (cand.getPriority() >= cand2.getPriority()))
|
||||
{
|
||||
localCandidates.remove(j);
|
||||
if(logger.isLoggable(Level.FINEST))
|
||||
if (logger.isLoggable(Level.FINEST))
|
||||
{
|
||||
logger.finest(
|
||||
"eliminating redundant cand: "+ cand2);
|
||||
@ -905,10 +905,12 @@ public class Component
|
||||
*/
|
||||
public RemoteCandidate findRemoteCandidate(TransportAddress remoteAddress)
|
||||
{
|
||||
for(RemoteCandidate remoteCnd : remoteCandidates)
|
||||
for (RemoteCandidate remoteCnd : remoteCandidates)
|
||||
{
|
||||
if(remoteCnd.getTransportAddress().equals(remoteAddress))
|
||||
if (remoteCnd.getTransportAddress().equals(remoteAddress))
|
||||
{
|
||||
return remoteCnd;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -955,11 +957,17 @@ public class Component
|
||||
public String getName()
|
||||
{
|
||||
if (componentID == RTP)
|
||||
{
|
||||
return "RTP";
|
||||
else if(componentID == RTCP)
|
||||
}
|
||||
else if (componentID == RTCP)
|
||||
{
|
||||
return "RTCP";
|
||||
}
|
||||
else
|
||||
{
|
||||
return Integer.toString(componentID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user