Skip to content

Commit bc7ff35

Browse files
committed
Native ice client fix
When we find an existing reflexive candidate to the same localAddr then: - If it's valid, then immediately bail, we are done. - If it's a failure marker, then delete it and continue to process the new callback.
1 parent f81e6b3 commit bc7ff35

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,30 +1696,34 @@ void CSteamNetworkingICESession::STUNRequestCallback_ServerReflexiveCandidate( c
16961696
return;
16971697

16981698
const SteamNetworkingIPAddr localAddr = info.m_pRequest->m_localAddr;
1699-
bool bFound = false;
1700-
for ( const ICECandidate& c : m_vecCandidates )
1699+
for ( int i = 0 ; i < len(m_vecCandidates) ; ++i )
17011700
{
1701+
ICECandidate& c = m_vecCandidates[i];
17021702
if ( c.m_type == kICECandidateType_ServerReflexive && c.m_base == localAddr )
17031703
{
1704-
bFound = true;
1705-
break;
1704+
// Another response for a candidate we already have.
1705+
1706+
// But if the current candidate is a "failed" placeholder, remove it
1707+
// and keep going to process this new response.
1708+
if ( c.m_addr.IsIPv6AllZeros() )
1709+
{
1710+
erase_at( m_vecCandidates, i );
1711+
break;
1712+
}
1713+
return;
17061714
}
17071715
}
17081716

17091717
uint32 uLocalPriority = 0;
1710-
for ( const Interface& i : m_vecInterfaces )
1718+
for ( const Interface& iface : m_vecInterfaces )
17111719
{
1712-
if ( i.m_localaddr == localAddr )
1720+
if ( iface.m_localaddr == localAddr )
17131721
{
1714-
uLocalPriority = i.m_nPriority;
1722+
uLocalPriority = iface.m_nPriority;
17151723
break;
17161724
}
17171725
}
17181726

1719-
// Another response for a candidate we already have? Just drop it.
1720-
if ( bFound )
1721-
return;
1722-
17231727
SteamNetworkingIPAddr bindResult;
17241728
bindResult.Clear();
17251729
if ( ReadAnyMappedAddress( info.m_pAttributes, info.m_nAttributes, info.m_pHeader, &bindResult ) )

0 commit comments

Comments
 (0)