Skip to content

Commit

Permalink
feat: Allow Component.send to send over a valid (but not selected) pair.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Oct 1, 2024
1 parent fc0061f commit 1fe84d7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/org/ice4j/ice/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -1202,18 +1202,23 @@ public Logger getLogger()
public void send(byte[] buffer, int offset, int length)
throws IOException
{
CandidatePair selectedPair = getSelectedPair();
if (selectedPair == null)
CandidatePair pair = getSelectedPair();
if (pair == null)
{
throw new IOException("No selected pair.");
logger.debug("No selected pair, will try valid for sending");
pair = parentStream.getValidPair(this);
if (pair == null)
{
throw new IOException("No valid pair.");
}
}

LocalCandidate localCandidate = selectedPair.getLocalCandidate();
LocalCandidate localCandidate = pair.getLocalCandidate();
if (localCandidate != null && localCandidate.getBase() != null)
{
localCandidate = localCandidate.getBase();
}
SocketAddress remoteAddress = selectedPair.getRemoteCandidate().getTransportAddress();
SocketAddress remoteAddress = pair.getRemoteCandidate().getTransportAddress();
IceSocketWrapper socket
= localCandidate == null ? null : localCandidate.getCandidateIceSocketWrapper(remoteAddress);

Expand Down

0 comments on commit 1fe84d7

Please sign in to comment.