Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ private void OnDestroy()
{
OnNetworkLoopSystemRemove();
//NSS: This is ok to leave this check here
rpcQueueContainer?.OnExiting();
rpcQueueContainer?.Shutdown();

if (Singleton != null && Singleton == this)
{
Expand All @@ -693,7 +693,8 @@ private void Shutdown()
SpawnManager.DestroyNonSceneObjects();
SpawnManager.ServerResetShudownStateForSceneObjects();

if (NetworkConfig != null && NetworkConfig.NetworkTransport != null) //The Transport is set during Init time, thus it is possible for the Transport to be null
//The Transport is set during Init time, thus it is possible for the Transport to be null
if (NetworkConfig != null && NetworkConfig.NetworkTransport != null)
NetworkConfig.NetworkTransport.Shutdown();

if (rpcQueueContainer != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,9 @@ public bool IsTesting()
return m_IsTestingEnabled;
}


/// <summary>
/// Clears all declared parameters
/// Clears the stream indices and frames process properties
/// </summary>
private void ClearParameters()
{
Expand All @@ -661,10 +662,12 @@ private void ClearParameters()
}

/// <summary>
/// OnExiting
/// Called upon exiting to assure any last messages are delivered.
/// Shutdown
/// Flushes the internal messages
/// Removes itself from the network update loop
/// Disposes readers, writers, clears the queue history, and resets any parameters
/// </summary>
public void OnExiting()
public void Shutdown()
{
//We need to make sure all internal messages (i.e. object destroy) are sent
rpcQueueProcessing.InternalMessagesSendAndFlush();
Expand All @@ -675,14 +678,8 @@ public void OnExiting()
//Remove ourself from the network loop update system
OnNetworkLoopSystemRemove();
}
}

/// <summary>
/// There might be a case where we want to make this class non-static and in that case we would replace this with Dispose and add the IDisposable interface
/// For now, this should be called upon shutdown
/// </summary>
public void Shutdown()
{
//Dispose of any readers and writers
foreach (KeyValuePair<QueueHistoryFrame.QueueFrameType, Dictionary<int, Dictionary<NetworkUpdateManager.NetworkUpdateStages, QueueHistoryFrame>>> queueHistorySection in QueueHistory)
{
foreach (KeyValuePair<int, Dictionary<NetworkUpdateManager.NetworkUpdateStages, QueueHistoryFrame>> queueHistoryItemByStage in queueHistorySection.Value)
Expand All @@ -696,6 +693,7 @@ public void Shutdown()
}
}

//Clear history and parameters
QueueHistory.Clear();

ClearParameters();
Expand Down