@@ -915,6 +915,7 @@ void CSteamNetworkingSocketsSTUNRequest::Queue( uint32 nMessageType, int nEncodi
915915{
916916 m_remoteAddr = remoteAddr;
917917 m_nRetryCount = 0 ;
918+ m_nMessageType = nMessageType;
918919 // Retry schedule: 400ms initial interval, growing by 1.5x each attempt.
919920 // Send times (approximate): 0, 400ms, 1.0s, 1.9s, 3.25s -> give up at ~5.3s.
920921 // RFC 5389 uses 500ms initial RTO doubling each retry over 7+ attempts (~32-64s total),
@@ -939,22 +940,6 @@ void CSteamNetworkingSocketsSTUNRequest::Queue( uint32 nMessageType, int nEncodi
939940}
940941
941942
942- void CSteamNetworkingSocketsSTUNRequest::Cancel ()
943- {
944- if ( m_callback )
945- {
946- RecvSTUNPktInfo_t subInfo;
947- subInfo.m_pRequest = this ;
948- subInfo.m_pHeader = nullptr ;
949- subInfo.m_nAttributes = 0 ;
950- subInfo.m_pAttributes = nullptr ;
951- subInfo.m_usecNow = SteamNetworkingSockets_GetLocalTimestamp ();
952- ( m_pInterface->m_session .*m_callback )( subInfo );
953- }
954-
955- delete this ;
956- }
957-
958943void CSteamNetworkingSocketsSTUNRequest::RetriggerNow ()
959944{
960945 m_nRetryCount = 0 ;
@@ -1005,14 +990,24 @@ void CSteamNetworkingSocketsSTUNRequest::Think( SteamNetworkingMicroseconds usec
1005990 }
1006991 else
1007992 {
1008- SpewVerboseGroup ( GlobalConfig::LogLevel_P2PRendezvous.Get (), " ICE: STUN request to %s timed out.\n " ,
1009- SteamNetworkingIPAddrRender ( m_remoteAddr ).c_str () );
993+ SpewVerboseGroup ( GlobalConfig::LogLevel_P2PRendezvous.Get (), " ICE: STUN request 0x%x to %s timed out.\n " ,
994+ m_nMessageType, SteamNetworkingIPAddrRender ( m_remoteAddr ).c_str () );
1010995 }
1011996
1012- // Call the callback to notify that we've failed, and SELF DESTRUCT.
1013- Cancel ();
997+ // Call the callback to notify that we've failed
998+ if ( m_callback )
999+ {
1000+ RecvSTUNPktInfo_t subInfo;
1001+ subInfo.m_pRequest = this ;
1002+ subInfo.m_pHeader = nullptr ;
1003+ subInfo.m_nAttributes = 0 ;
1004+ subInfo.m_pAttributes = nullptr ;
1005+ subInfo.m_usecNow = SteamNetworkingSockets_GetLocalTimestamp ();
1006+ ( m_pInterface->m_session .*m_callback )( subInfo );
1007+ }
10141008
1015- // WARNING: We don't exist here!
1009+ // SELF DESTRUCT
1010+ delete this ;
10161011}
10171012
10181013void CSteamNetworkingSocketsSTUNRequest::ReplyPacketReceived ( const RecvPktInfo_t &info, const STUNHeader &header )
@@ -1021,8 +1016,9 @@ void CSteamNetworkingSocketsSTUNRequest::ReplyPacketReceived( const RecvPktInfo_
10211016 CUtlVector< STUNAttribute > vecAttributes;
10221017 if ( !ParseSTUNAttributes ( info, (const byte*)m_strPassword.c_str (), (uint32)m_strPassword.size (), &vecAttributes ) )
10231018 {
1024- SpewVerboseGroup ( GlobalConfig::LogLevel_P2PRendezvous.Get (), " ICE: Dropping STUN response from %s: attribute parse or integrity failure.\n " ,
1025- SteamNetworkingIPAddrRender ( m_remoteAddr ).c_str () );
1019+ SpewVerboseGroup ( GlobalConfig::LogLevel_P2PRendezvous.Get (),
1020+ " ICE: Dropping STUN response 0x%x from %s: attribute parse or integrity failure.\n " ,
1021+ m_nMessageType, SteamNetworkingIPAddrRender ( m_remoteAddr ).c_str () );
10261022 return ;
10271023 }
10281024
0 commit comments