feat: Adds accessors for candidatates' sockets when they have more than one.
This commit is contained in:
parent
b4a5e2eb83
commit
d5410b922b
@ -153,6 +153,21 @@ public abstract class LocalCandidate
|
||||
*/
|
||||
protected abstract IceSocketWrapper getCandidateIceSocketWrapper();
|
||||
|
||||
/**
|
||||
* @return the {@link IceSocketWrapper} instance for this candidate,
|
||||
* associated with a particular remote address.
|
||||
* @param remoteAddress the remote address for which to return an
|
||||
* associated socket.
|
||||
*/
|
||||
protected IceSocketWrapper getCandidateIceSocketWrapper(
|
||||
SocketAddress remoteAddress)
|
||||
{
|
||||
// The default implementation just refers to the method which doesn't
|
||||
// involve a remove address. Extenders which support multiple instances
|
||||
// mapped by remote address should override.
|
||||
return getCandidateIceSocketWrapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates if necessary and returns a <tt>DatagramSocket</tt> that would
|
||||
* capture all STUN packets arriving on this candidate's socket. If the
|
||||
|
||||
@ -54,6 +54,23 @@ public class TcpHostCandidate
|
||||
super(transportAddress, parentComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected IceSocketWrapper getCandidateIceSocketWrapper(
|
||||
SocketAddress remoteAddress)
|
||||
{
|
||||
for (IceSocketWrapper socket : sockets)
|
||||
{
|
||||
if (socket.getTCPSocket().getRemoteSocketAddress()
|
||||
.equals(remoteAddress))
|
||||
return socket;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addSocket(IceSocketWrapper socket)
|
||||
{
|
||||
sockets.add(socket);
|
||||
|
||||
@ -376,5 +376,15 @@ public class SinglePortUdpHarvester
|
||||
sockets.put(remoteAddress, socket);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected IceSocketWrapper getCandidateIceSocketWrapper(
|
||||
SocketAddress remoteAddress)
|
||||
{
|
||||
return candidateSockets.get(remoteAddress);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user