ref: Rename variables. (#209)

This commit is contained in:
bgrozev 2020-06-10 15:15:11 -05:00 committed by GitHub
parent ed63ae8e11
commit 686164ffc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 34 deletions

View File

@ -1466,44 +1466,45 @@ public class Agent
/** /**
* Returns the local <tt>LocalCandidate</tt> with the specified * 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. * 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 * @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. * 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 * 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, * 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}. * 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. * @param base an optional base to match.
* *
* @return the local <tt>LocalCandidate</tt> with the specified * @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. * streams or <tt>null</tt> if it doesn't.
*/ */
public LocalCandidate findLocalCandidate( public LocalCandidate findLocalCandidate(
TransportAddress localAddress, TransportAddress address,
LocalCandidate base) LocalCandidate base)
{ {
for (IceMediaStream stream : mediaStreams.values()) 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; return null;

View File

@ -925,41 +925,41 @@ public class Component
/** /**
* Returns the local <tt>LocalCandidate</tt> with the specified * 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 * if it doesn't. If {@code base} is also specified, tries to find a
* candidate whose base matches {@code base}. * 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. * @param base an optional base to match.
* *
* @return the local <tt>LocalCandidate</tt> with the specified * @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. * 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 // In case the above loop failed to find a result because `base` was
// specified, fallback to the original behavior and return the first // specified, fallback to the original behavior and return the first
// candidate matching `localAddress` regardless of `base`. // candidate matching `address` regardless of `base`.
for (LocalCandidate localCnd : localCandidates) for (LocalCandidate localCandidate : localCandidates)
{ {
if (localCnd.getTransportAddress().equals(localAddress)) if (localCandidate.getTransportAddress().equals(address))
{ {
logger.warn("Returning a candidate matching the address, " logger.warn("Returning a candidate matching the address, "
+ "while no candidates match both address (" + "while no candidates match both address ("
+ localAddress + ") and base (" + base +"): " + localCnd + address + ") and base (" + base +"): " + localCandidate
+ " with base " + localCnd.getBase()); + " with base " + localCandidate.getBase());
return localCnd; return localCandidate;
} }
} }

View File

@ -507,26 +507,27 @@ public class IceMediaStream
/** /**
* Returns the local <tt>LocalCandidate</tt> with the specified * 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 * or <tt>null</tt> otherwise. If {@code base} is also specified, tries to
* find a candidate whose base matches {@code base}. * 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. * @param base an optional base to match.
* *
* @return the local <tt>LocalCandidate</tt> with the specified * @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. * 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;
} }
} }