mirror of
https://github.com/ValveSoftware/GameNetworkingSockets.git
synced 2026-05-29 16:20:34 +00:00
Small optimization in SteamNetworkingMessagesSession::CheckConnection
Move check to see if we are idle to be inside the (rarely true) if() branch where we use it. This could become a bit more important in the future if SNP_BHasAnyBufferedRecvData() becomes more expensive when lanes are added. P4:6806855
This commit is contained in:
@@ -800,9 +800,6 @@ void SteamNetworkingMessagesSession::CheckConnection( SteamNetworkingMicrosecond
|
||||
|
||||
UpdateConnectionInfo();
|
||||
|
||||
bool bIdle = !m_pConnection->SNP_BHasAnyBufferedRecvData()
|
||||
&& !m_pConnection->SNP_BHasAnyUnackedSentReliableData();
|
||||
|
||||
// Safety check in case the connection got nuked without going thorugh an expected terminal state
|
||||
if ( !m_pConnection->BStateIsActive() )
|
||||
{
|
||||
@@ -818,6 +815,9 @@ void SteamNetworkingMessagesSession::CheckConnection( SteamNetworkingMicrosecond
|
||||
// Check if the connection died
|
||||
if ( m_lastConnectionInfo.m_eState == k_ESteamNetworkingConnectionState_ProblemDetectedLocally || m_lastConnectionInfo.m_eState == k_ESteamNetworkingConnectionState_ClosedByPeer )
|
||||
{
|
||||
bool bIdle = !m_pConnection->SNP_BHasAnyBufferedRecvData()
|
||||
&& !m_pConnection->SNP_BHasAnyUnackedSentReliableData();
|
||||
|
||||
SpewVerbose( "[%s] messages session %s: %d %s\n",
|
||||
m_lastConnectionInfo.m_szConnectionDescription,
|
||||
m_lastConnectionInfo.m_eState == k_ESteamNetworkingConnectionState_ProblemDetectedLocally ? "problem detected locally" : "closed by peer",
|
||||
|
||||
Reference in New Issue
Block a user