Skip to content

Commit a52b0ad

Browse files
committed
Fix bugs with ISteamMessages interface.
That isn't part of the opensource code (yet).
1 parent 7768222 commit a52b0ad

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_connections.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ CSteamNetworkConnectionBase::~CSteamNetworkConnectionBase()
386386
Assert( m_eConnectionState == k_ESteamNetworkingConnectionState_Dead );
387387
Assert( m_queueRecvMessages.IsEmpty() );
388388
Assert( m_pParentListenSocket == nullptr );
389+
Assert( m_pMessagesSession == nullptr );
389390
}
390391

391392
void CSteamNetworkConnectionBase::Destroy()
@@ -413,6 +414,9 @@ void CSteamNetworkConnectionBase::FreeResources()
413414
// while we still know who our listen socket is (if any).
414415
SetState( k_ESteamNetworkingConnectionState_Dead, SteamNetworkingSockets_GetLocalTimestamp() );
415416

417+
// We should be detatched from any mesages session!
418+
Assert( m_pMessagesSession == nullptr );
419+
416420
// Discard any messages that weren't retrieved
417421
m_queueRecvMessages.PurgeMessages();
418422

@@ -1497,7 +1501,7 @@ void CSteamNetworkConnectionBase::ConnectionStateChanged( ESteamNetworkingConnec
14971501
}
14981502
else
14991503
{
1500-
m_pMessagesSession->ConnectionStateChanged( eOldState, GetState() );
1504+
m_pMessagesSession->ConnectionStateChanged( eOldAPIState, eNewAPIState );
15011505
}
15021506
}
15031507
else
@@ -1840,8 +1844,15 @@ void CSteamNetworkConnectionBase::CheckConnectionStateAndSetNextThinkTime( Steam
18401844
// We should squawk about this and let them know.
18411845
if ( m_eConnectionState != k_ESteamNetworkingConnectionState_FindingRoute && m_pParentListenSocket )
18421846
{
1843-
AssertMsg( false, "Application didn't accept or close incoming connection in a reasonable amount of time. This is probably a bug." );
1844-
ConnectionState_ProblemDetectedLocally( k_ESteamNetConnectionEnd_Misc_Timeout, "%s", "App didn't accept or close incoming connection in time." );
1847+
if ( m_pMessagesSession )
1848+
{
1849+
ConnectionState_ProblemDetectedLocally( k_ESteamNetConnectionEnd_Misc_Timeout, "%s", "App did not respond to Messages session request in time, discarding." );
1850+
}
1851+
else
1852+
{
1853+
AssertMsg( false, "Application didn't accept or close incoming connection in a reasonable amount of time. This is probably a bug." );
1854+
ConnectionState_ProblemDetectedLocally( k_ESteamNetConnectionEnd_Misc_Timeout, "%s", "App didn't accept or close incoming connection in time." );
1855+
}
18451856
}
18461857
else
18471858
{

0 commit comments

Comments
 (0)