@@ -849,8 +849,10 @@ int TEST_ICE_ctr_binding_req_recv = 0; // binding requests received from peer
849849int TEST_ICE_ctr_binding_resp_send = 0 ; // binding responses we sent
850850int TEST_ICE_ctr_binding_resp_recv = 0 ; // binding responses we received
851851int TEST_ICE_ctr_allocate_send = 0 ; // TURN allocate requests sent
852- int TEST_ICE_ctr_send_ind_send = 0 ; // TURN send indications sent (data out via relay)
853- int TEST_ICE_ctr_data_ind_recv = 0 ; // TURN data indications received (data in via relay)
852+ int TEST_ICE_ctr_send_ind_send = 0 ; // TURN send indications sent (data out via relay)
853+ int TEST_ICE_ctr_data_ind_recv = 0 ; // TURN data indications received (data in via relay)
854+ int TEST_ICE_ctr_binding_req_retx = 0 ; // binding request retransmissions (not counting initial send)
855+ int TEST_ICE_ctr_allocate_retx = 0 ; // TURN allocate request retransmissions
854856
855857void TEST_ICE_ctr_Reset ()
856858{
@@ -860,8 +862,10 @@ void TEST_ICE_ctr_Reset()
860862 TEST_ICE_ctr_binding_resp_send = 0 ;
861863 TEST_ICE_ctr_binding_resp_recv = 0 ;
862864 TEST_ICE_ctr_allocate_send = 0 ;
863- TEST_ICE_ctr_send_ind_send = 0 ;
864- TEST_ICE_ctr_data_ind_recv = 0 ;
865+ TEST_ICE_ctr_send_ind_send = 0 ;
866+ TEST_ICE_ctr_data_ind_recv = 0 ;
867+ TEST_ICE_ctr_binding_req_retx = 0 ;
868+ TEST_ICE_ctr_allocate_retx = 0 ;
865869}
866870
867871void TEST_ICE_ctr_Print ()
@@ -873,6 +877,8 @@ void TEST_ICE_ctr_Print()
873877 SpewMsg ( " TEST_ICE_ctr_allocate_send=%d\n " , TEST_ICE_ctr_allocate_send );
874878 SpewMsg ( " TEST_ICE_ctr_send_ind_send=%d\n " , TEST_ICE_ctr_send_ind_send );
875879 SpewMsg ( " TEST_ICE_ctr_data_ind_recv=%d\n " , TEST_ICE_ctr_data_ind_recv );
880+ SpewMsg ( " TEST_ICE_ctr_binding_req_retx=%d\n " , TEST_ICE_ctr_binding_req_retx );
881+ SpewMsg ( " TEST_ICE_ctr_allocate_retx=%d\n " , TEST_ICE_ctr_allocate_retx );
876882}
877883
878884// Compare IP addresses, ignoring the port.
@@ -973,7 +979,19 @@ void CSteamNetworkingSocketsSTUNRequest::Think( SteamNetworkingMicroseconds usec
973979 if ( m_pInterface->SendPacketGather ( 1 , &temp, m_cbPacketSize, m_remoteAddr, m_addrRelay ) )
974980 {
975981 m_usecLastSentTime = usecNow;
976- SetNextThinkTime ( usecNow + retryTimeout );
982+ if ( m_nRetryCount > 1 )
983+ {
984+ // Decode message type from the packet header (type occupies the top 16 bits
985+ // of the first word) and tally by type so tests can verify the retry schedule.
986+ const uint32 nMsgType = ntohl ( m_packet[0 ] ) >> 16 ;
987+ if ( nMsgType == k_nSTUN_BindingRequest )
988+ ++TEST_ICE_ctr_binding_req_retx;
989+ else if ( nMsgType == k_nTURN_AllocateRequest )
990+ ++TEST_ICE_ctr_allocate_retx;
991+ else
992+ AssertMsg ( false , " Untracked STUN retransmit type 0x%x" , nMsgType );
993+ }
994+ SetNextThinkTime ( usecNow + usecInterval );
977995 return ;
978996 }
979997
0 commit comments