Skip to content

Commit

Permalink
ref: Rename variables. (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Jun 10, 2020
1 parent ed63ae8 commit 686164f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
25 changes: 13 additions & 12 deletions src/main/java/org/ice4j/ice/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -1466,44 +1466,45 @@ public boolean isControlling()

/**
* Returns the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this {@link Agent}'s
* <tt>address</tt> if it belongs to any of this {@link Agent}'s
* streams or <tt>null</tt> if it doesn't.
*
* @param localAddress the {@link TransportAddress} we are looking for.
* @param address the {@link TransportAddress} we are looking for.
*
* @return the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this {@link Agent}'s
* <tt>address</tt> if it belongs to any of this {@link Agent}'s
* streams or <tt>null</tt> if it doesn't.
*/
public LocalCandidate findLocalCandidate(TransportAddress localAddress)
public LocalCandidate findLocalCandidate(TransportAddress address)
{
return findLocalCandidate(localAddress, null);
return findLocalCandidate(address, null);
}

/**
* Returns the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this {@link Agent}'s
* <tt>address</tt> if it belongs to any of this {@link Agent}'s
* streams or <tt>null</tt> if it doesn't. If {@code base} is also specified,
* tries to find a candidate whose base matches {@code base}.
*
* @param localAddress the {@link TransportAddress} we are looking for.
* @param address the {@link TransportAddress} we are looking for.
* @param base an optional base to match.
*
* @return the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this {@link Agent}'s
* <tt>address</tt> if it belongs to any of this {@link Agent}'s
* streams or <tt>null</tt> if it doesn't.
*/
public LocalCandidate findLocalCandidate(
TransportAddress localAddress,
TransportAddress address,
LocalCandidate base)
{
for (IceMediaStream stream : mediaStreams.values())
{
LocalCandidate cnd = stream.findLocalCandidate(localAddress, base);
LocalCandidate localCandidate
= stream.findLocalCandidate(address, base);

if (cnd != null)
if (localCandidate != null)
{
return cnd;
return localCandidate;
}
}
return null;
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/org/ice4j/ice/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -925,41 +925,41 @@ public LocalCandidate findLocalCandidate(TransportAddress localAddress)

/**
* Returns the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to this component or <tt>null</tt>
* <tt>address</tt> if it belongs to this component or <tt>null</tt>
* if it doesn't. If {@code base} is also specified, tries to find a
* candidate whose base matches {@code base}.
*
* @param localAddress the {@link TransportAddress} we are looking for.
* @param address the {@link TransportAddress} we are looking for.
* @param base an optional base to match.
*
* @return the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to this component or <tt>null</tt>
* <tt>address</tt> if it belongs to this component or <tt>null</tt>
* if it doesn't.
*/
public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base)
public LocalCandidate findLocalCandidate(TransportAddress address, LocalCandidate base)
{
for (LocalCandidate localCnd : localCandidates)
for (LocalCandidate localCandidate : localCandidates)
{
if (localCnd.getTransportAddress().equals(localAddress))
if (localCandidate.getTransportAddress().equals(address))
{
if (base == null || base.equals(localCnd.getBase()))
if (base == null || base.equals(localCandidate.getBase()))
{
return localCnd;
return localCandidate;
}
}
}
// In case the above loop failed to find a result because `base` was
// specified, fallback to the original behavior and return the first
// candidate matching `localAddress` regardless of `base`.
for (LocalCandidate localCnd : localCandidates)
// candidate matching `address` regardless of `base`.
for (LocalCandidate localCandidate : localCandidates)
{
if (localCnd.getTransportAddress().equals(localAddress))
if (localCandidate.getTransportAddress().equals(address))
{
logger.warn("Returning a candidate matching the address, "
+ "while no candidates match both address ("
+ localAddress + ") and base (" + base +"): " + localCnd
+ " with base " + localCnd.getBase());
return localCnd;
+ address + ") and base (" + base +"): " + localCandidate
+ " with base " + localCandidate.getBase());
return localCandidate;
}
}

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/org/ice4j/ice/IceMediaStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,26 +507,27 @@ protected void setMaxCheckListSize(int nSize)

/**
* Returns the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this stream's components
* <tt>address</tt> if it belongs to any of this stream's components
* or <tt>null</tt> otherwise. If {@code base} is also specified, tries to
* find a candidate whose base matches {@code base}.
*
* @param localAddress the {@link TransportAddress} we are looking for.
* @param address the {@link TransportAddress} we are looking for.
* @param base an optional base to match.
*
* @return the local <tt>LocalCandidate</tt> with the specified
* <tt>localAddress</tt> if it belongs to any of this stream's components
* <tt>address</tt> if it belongs to any of this stream's components
* or <tt>null</tt> otherwise.
*/
public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base)
public LocalCandidate findLocalCandidate(TransportAddress address, LocalCandidate base)
{
for (Component cmp : components.values())
for (Component component : components.values())
{
LocalCandidate cnd = cmp.findLocalCandidate(localAddress, base);
LocalCandidate localCandidate
= component.findLocalCandidate(address, base);

if (cnd != null)
if (localCandidate != null)
{
return cnd;
return localCandidate;
}
}

Expand Down

0 comments on commit 686164f

Please sign in to comment.