From 6c3b5152ebddf77db750bdfe398082a93116fff9 Mon Sep 17 00:00:00 2001 From: sashakosti Date: Sun, 11 Oct 2026 03:45:21 +0300 Subject: [PATCH] ice: Reset TURN auth state when failing over to next server When a TURN allocate request times out, STUNRequestCallback_AllocateRelay attempts to fail over to the next server in m_vecTURNServers. However, m_strTURNRealm, m_strTURNNonce, and m_arrTURNKey were retained from the previous server. This caused QueueTURNRequest to immediately send an authenticated Allocate to the new server using the previous server's realm and nonce, leading to authentication rejection and premature relay failure. Reset m_strTURNRealm, m_strTURNNonce, and m_arrTURNKey before queueing the request on the next TURN server to ensure a clean handshake. Fixes #445 --- .../clientlib/steamnetworkingsockets_ice_client.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp index e5a48147..ada15e49 100644 --- a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp +++ b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp @@ -2100,6 +2100,9 @@ void CSteamNetworkingICESession::STUNRequestCallback_AllocateRelay( const RecvST } // Try the next TURN server. + pIntf->m_strTURNRealm.clear(); + pIntf->m_strTURNNonce.clear(); + memset( pIntf->m_arrTURNKey, 0, sizeof( pIntf->m_arrTURNKey ) ); pIntf->QueueAllocateRequest( m_vecTURNServers[nNextTURNServerIdx], &CSteamNetworkingICESession::STUNRequestCallback_AllocateRelay, m_nEncoding ); }