Fix shutdown order of operations bug causing assert

P4:6666302
This commit is contained in:
Fletcher Dunn
2021-07-13 12:40:34 -07:00
parent 219aef1052
commit 511cd5c167
@@ -2686,15 +2686,6 @@ void SteamNetworkingSocketsLowLevelDecRef()
// might need to do stuff when we close a bunch of sockets (and WSACleanup)
SteamNetworkingGlobalLock::SetLongLockWarningThresholdMS( "SteamNetworkingSocketsLowLevelDecRef", 500 );
if ( s_vecRawSockets.IsEmpty() )
{
s_vecRawSockets.Purge();
}
else
{
AssertMsg( false, "Trying to close low level socket support, but we still have sockets open!" );
}
// Stop the service thread, if we have one
if ( s_pThreadSteamDatagram )
StopSteamDatagramThread();
@@ -2725,6 +2716,16 @@ void SteamNetworkingSocketsLowLevelDecRef()
// Check for any leftover tasks that were queued to be run while we hold the lock
ProcessDeferredOperations();
// At this point, we shouldn't have any remaining sockets
if ( s_vecRawSockets.IsEmpty() )
{
s_vecRawSockets.Purge();
}
else
{
AssertMsg( false, "Trying to close low level socket support, but we still have sockets open!" );
}
// Nuke packet lagger queues and make sure we are not registered to think
s_packetLagQueueRecv.Clear();
s_packetLagQueueSend.Clear();