Skip to content

Commit f3db829

Browse files
authored
fix: Fail connectivity checks for non-keep-alive pairs (#304)
* fix: Fail connectivity checks for non-keep-alive pairs This covers a case that was missed in #287. When multiple pairs are SUCCEEDED before we reach the TERMINATED state, we keep responding to them.
1 parent fcadc70 commit f3db829

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/org/ice4j/ice/Agent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,16 @@ private boolean triggerCheck(CandidatePair triggerPair)
17031703
checkListStatesUpdated();
17041704
}
17051705

1706+
if (getState() == IceProcessingState.TERMINATED
1707+
&& knownPair.getParentComponent().getKeepAliveStrategy() != KeepAliveStrategy.ALL_SUCCEEDED)
1708+
{
1709+
// After we've terminated, only respond for the selected pair
1710+
CandidatePair selected
1711+
= getSelectedPair(knownPair.getParentComponent().getParentStream().getName());
1712+
return selected != null
1713+
&& knownPair.getRemoteCandidate().getTransportAddress().equals(
1714+
selected.getRemoteCandidate().getTransportAddress());
1715+
}
17061716
return true;
17071717
}
17081718

src/main/java/org/ice4j/ice/Component.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ protected Component(int componentID,
225225
mediaStream.addPairChangeListener(this);
226226
}
227227

228+
public KeepAliveStrategy getKeepAliveStrategy()
229+
{
230+
return keepAliveStrategy;
231+
}
232+
228233
/**
229234
* Add a local candidate to this component. The method should only be
230235
* accessed and local candidates added by the candidate harvesters

0 commit comments

Comments
 (0)