From c2e67175fffc44de7d71470e68a29ccffd481769 Mon Sep 17 00:00:00 2001 From: Fletcher Dunn Date: Fri, 29 Oct 2021 15:17:39 -0700 Subject: [PATCH] Another fix deciding when to send a signal The server should never send a signal until the connection is accepted by the app, under any circumstances. P4:6865152 --- .../clientlib/steamnetworkingsockets_p2p.cpp | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_p2p.cpp b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_p2p.cpp index d727e45..4b1d169 100644 --- a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_p2p.cpp +++ b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_p2p.cpp @@ -1275,6 +1275,21 @@ void CSteamNetworkConnectionP2P::ThinkConnection( SteamNetworkingMicroseconds us if ( !m_pSignaling ) return; + // We can't send our initial signals without certs, etc + if ( GetState() == k_ESteamNetworkingConnectionState_Connecting ) + { + if ( !BThinkCryptoReady( usecNow ) ) + { + EnsureMinThinkTime( usecNow + k_nMillion/20 ); + return; + } + + // If we're the server, then don't send any signals until + // the connection is actually accepted. + if ( m_bConnectionInitiatedRemotely ) + return; + } + // Time to send a signal? // Limit using really basic minimum spacing between successive calls SteamNetworkingMicroseconds usecReliableRTO = GetSignalReliableRTO(); @@ -1286,16 +1301,6 @@ void CSteamNetworkConnectionP2P::ThinkConnection( SteamNetworkingMicroseconds us return; } - // We can't send our initial signals without certs, etc - if ( GetState() == k_ESteamNetworkingConnectionState_Connecting ) - { - if ( !BThinkCryptoReady( usecNow ) ) - { - EnsureMinThinkTime( usecNow + k_nMillion/20 ); - return; - } - } - // Check if we should delay sending a signal until // we collect a bit of initial routing info SteamNetworkingMicroseconds usecRoutingReady = CheckWaitForInitialRoutingReady( usecNow );