diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java index e42f7a0..3bb645d 100644 --- a/src/org/ice4j/ice/Agent.java +++ b/src/org/ice4j/ice/Agent.java @@ -674,7 +674,7 @@ public class Agent * @return the number of {@link CheckList}s that are currently active. * */ - public int getActiveCheckListCount() + protected int getActiveCheckListCount() { synchronized(mediaStreams) { @@ -885,11 +885,11 @@ public class Agent * @param useCandidate indicates whether the incoming check {@link Request} * contained the USE-CANDIDATE ICE attribute. */ - public void incomingCheckReceived(TransportAddress remoteAddress, - TransportAddress localAddress, - long priority, - String remoteUFrag, - boolean useCandidate) + protected void incomingCheckReceived(TransportAddress remoteAddress, + TransportAddress localAddress, + long priority, + String remoteUFrag, + boolean useCandidate) { LocalCandidate localCandidate = findLocalCandidate(localAddress); Component parentComponent = localCandidate.getParentComponent(); @@ -1011,7 +1011,7 @@ public class Agent * * @param validPair the {@link CandidatePair} we'd like to validate. */ - public void validatePair(CandidatePair validPair) + protected void validatePair(CandidatePair validPair) { IceMediaStream parentStream = validPair.getParentComponent().getParentStream(); @@ -1032,7 +1032,7 @@ System.out.println("valid pair was nominated " + validPair); * @param pairToNominate the {@link CandidatePair} whose nomination has * just been confirmed. */ - public void nominationConfirmed(CandidatePair pairToNominate) + protected void nominationConfirmed(CandidatePair pairToNominate) { pairToNominate.nominate(); System.out.println("pair nomination confirmed"); @@ -1061,7 +1061,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g * or a timeout event the method goes through all check lists and tries * to assess the state of ICE processing. */ - public void checkListStatesUpdated() + protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; @@ -1151,7 +1151,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g * a pre-configured value if the application has set one. *

*/ - public long calculateTa() + protected long calculateTa() { //if application specified a value - use it. other wise return .... // eeeer ... a "dynamically" calculated one ;) @@ -1194,7 +1194,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g * @return the value of the retransmission timer to use in STUN * transactions, while harvesting addresses. */ - public long calculateStunHarvestRTO() + protected long calculateStunHarvestRTO() { /* RFC 5245 says: * RTO = MAX (100ms, Ta * (number of pairs)) @@ -1217,7 +1217,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g * @return the value of the retransmission timer to use in STUN connectivity * check transactions.. */ - public long calculateStunConnCheckRTO() + protected long calculateStunConnCheckRTO() { /* RFC 5245 says: * For connectivity checks, RTO SHOULD be configurable and SHOULD have diff --git a/src/org/ice4j/ice/CheckList.java b/src/org/ice4j/ice/CheckList.java index e6df099..aac7f2b 100644 --- a/src/org/ice4j/ice/CheckList.java +++ b/src/org/ice4j/ice/CheckList.java @@ -50,7 +50,7 @@ public class CheckList * * @param name the name of the check list. */ - public CheckList(String name) + protected CheckList(String name) { this.name = name; } @@ -70,7 +70,7 @@ public class CheckList * * @param state the CheckListState for this list. */ - public void setState(CheckListState state) + protected void setState(CheckListState state) { this.state = state; } @@ -82,7 +82,7 @@ public class CheckList * * @param pair the pair to schedule a triggered check for. */ - public void scheduleTriggeredCheck(CandidatePair pair) + protected void scheduleTriggeredCheck(CandidatePair pair) { synchronized(triggeredCheckQueue) { @@ -101,7 +101,7 @@ public class CheckList * @return the first {@link CandidatePair} in the triggered check queue or * null if that queue is empty. */ - public CandidatePair popTriggeredCheck() + protected CandidatePair popTriggeredCheck() { synchronized(triggeredCheckQueue) { @@ -122,9 +122,8 @@ public class CheckList * connectivity check, which would either be the highest priority * Waiting pair or, when there's no such pair, the highest priority * Frozen pair or null otherwise - * */ - public synchronized CandidatePair getNextOrdinaryPairToCheck() + protected synchronized CandidatePair getNextOrdinaryPairToCheck() { if (size() < 1) return null; @@ -169,7 +168,7 @@ public class CheckList * @return true if this list is active and false * otherwise. */ - public synchronized boolean isActive() + protected synchronized boolean isActive() { for (CandidatePair pair : this) { @@ -187,7 +186,7 @@ public class CheckList * @return true if all pairs in this list are frozen and * false otherwise. */ - public synchronized boolean isFrozen() + protected synchronized boolean isFrozen() { for (CandidatePair pair : this) { @@ -228,7 +227,7 @@ public class CheckList * component ID to Waiting. If there is more than one such pair, the one * with the highest priority is used. */ - public synchronized void computeInitialCheckListPairStates() + protected synchronized void computeInitialCheckListPairStates() { Map pairsToWait = new Hashtable(); @@ -314,7 +313,7 @@ public class CheckList * @param nominatedPair the {@link CandidatePair} whose nomination we need * to handle. */ - public synchronized void handleNomination(CandidatePair nominatedPair) + protected synchronized void handleNomination(CandidatePair nominatedPair) { Component cmp = nominatedPair.getParentComponent(); Iterator pairsIter = iterator(); diff --git a/src/org/ice4j/ice/ConnectivityCheckClient.java b/src/org/ice4j/ice/ConnectivityCheckClient.java index 180596f..6f5eca8 100644 --- a/src/org/ice4j/ice/ConnectivityCheckClient.java +++ b/src/org/ice4j/ice/ConnectivityCheckClient.java @@ -12,14 +12,16 @@ import java.util.logging.*; import org.ice4j.*; import org.ice4j.attribute.*; -import org.ice4j.ice.*; import org.ice4j.message.*; import org.ice4j.stack.*; /** + * The class that will be generating our outgoing connectivity checks and that + * will be handling their responses or lack thereof. + * * @author Emil Ivov */ -public class ConnectivityCheckClient +class ConnectivityCheckClient implements ResponseCollector { /** @@ -44,12 +46,6 @@ public class ConnectivityCheckClient */ private final List paceMakers = new LinkedList(); - /** - * Contains the system time at the moment we last started a {@link - * PaceMaker}. - */ - private long lastPaceMakerStarted = 0; - /** * Creates a new ConnectivityCheckHandler setting * parentAgent as the agent that will be used for retrieving @@ -679,28 +675,4 @@ logger.fine("checklist " + checkList.getName() + " ran out of checks"); parentClient.paceMakers.remove(this); } } - - /** - * Returns the {@link PaceMaker} responsible for running checks for the - * specified {@link CheckList} - * - * @param list the {@link CheckList} whose {@link PaceMaker} we are trying - * to find. - * - * @return the {@link PaceMaker} responsible for running checks for the - * specified {@link CheckList} or null if we couldn't find one. - */ - private PaceMaker findPaceMaker(CheckList list) - { - synchronized(paceMakers) - { - for(PaceMaker paceMaker : paceMakers) - { - if (paceMaker.checkList == list) - return paceMaker; - } - } - - return null; - } } diff --git a/src/org/ice4j/ice/ConnectivityCheckServer.java b/src/org/ice4j/ice/ConnectivityCheckServer.java index fbde329..3df4571 100644 --- a/src/org/ice4j/ice/ConnectivityCheckServer.java +++ b/src/org/ice4j/ice/ConnectivityCheckServer.java @@ -10,14 +10,16 @@ import java.util.logging.*; import org.ice4j.*; import org.ice4j.attribute.*; -import org.ice4j.ice.*; import org.ice4j.message.*; import org.ice4j.security.*; import org.ice4j.stack.*; /** + * The class that would be handling and responding to incoming connectivity + * checks. + * * @author Emil Ivov */ -public class ConnectivityCheckServer +class ConnectivityCheckServer implements RequestListener, CredentialsAuthority { diff --git a/src/org/ice4j/ice/IceMediaStream.java b/src/org/ice4j/ice/IceMediaStream.java index 296a477..46475d6 100644 --- a/src/org/ice4j/ice/IceMediaStream.java +++ b/src/org/ice4j/ice/IceMediaStream.java @@ -552,7 +552,7 @@ public class IceMediaStream * * @param pair the {@link CandidatePair} to add to our valid list. */ - public void addValidPair(CandidatePair pair) + protected void addValidPair(CandidatePair pair) { synchronized (validList) { @@ -571,7 +571,7 @@ public class IceMediaStream * @return true if this stream's validList contains a * pair with the specified foundation and false otherwise. */ - public boolean validListContainsFoundation(String foundation) + protected boolean validListContainsFoundation(String foundation) { synchronized(validList) { @@ -592,7 +592,7 @@ public class IceMediaStream * one {@link CandidatePair} for each {@link Component} of the stream and * false otherwise. */ - public boolean validListContainsAllComponents() + protected boolean validListContainsAllComponents() { List cmpList = getComponents(); for(Component cmp : cmpList) @@ -617,7 +617,7 @@ public class IceMediaStream * CandidatePair} in the valid list for every {@link Component} of this * stream and false otherwise. */ - public boolean allComponentsAreNominated() + protected boolean allComponentsAreNominated() { List components = getComponents(); @@ -641,7 +641,7 @@ public class IceMediaStream * @return a valid {@link CandidatePair} for the specified * component if at least one exists, and null otherwise. */ - public CandidatePair getValidPair(Component component) + protected CandidatePair getValidPair(Component component) { synchronized(validList) {