Skip to content

Commit 8f8770a

Browse files
refactor: shutdown queue flush, max RpcQueueHistoryFrame, and spelling (#578)
This fixes the issue where if you exceeded the maximum number of RpcQueueHistoryFrames it would notify you but not cap the number. This also removes the m_NetworkManager null check during the shutdown. This fixes the misspelled rediculous to ridiculous in the initialize method sub-comments.
1 parent 3673ffc commit 8f8770a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public enum RpcQueueProcessingTypes
5151
private bool m_ProcessUpdateStagesExternally;
5252
private bool m_IsNotUsingBatching;
5353

54-
internal NetworkManager m_NetworkManager;
54+
internal readonly NetworkManager m_NetworkManager;
5555

5656
public bool IsUsingBatching()
5757
{
@@ -584,15 +584,16 @@ public void NetworkUpdate(NetworkUpdateStage updateStage)
584584
/// <param name="maxFrameHistory"></param>
585585
private void Initialize(uint maxFrameHistory)
586586
{
587-
//This makes sure that we don't exceed a rediculous value by capping the number of queue history frames to ushort.MaxValue
587+
//This makes sure that we don't exceed a ridiculous value by capping the number of queue history frames to ushort.MaxValue
588588
//If this value is exceeded, then it will be kept at the ceiling of ushort.Maxvalue.
589589
//Note: If running at a 60pps rate (16ms update frequency) this would yield 17.47 minutes worth of queue frame history.
590590
if (maxFrameHistory > ushort.MaxValue)
591591
{
592592
if (NetworkLog.CurrentLogLevel == LogLevel.Developer)
593593
{
594-
NetworkLog.LogWarning($"The maximum {nameof(RpcQueueHistoryFrame)} is {ushort.MaxValue}!");
594+
NetworkLog.LogWarning($"The {nameof(RpcQueueHistoryFrame)} size cannot exceed {ushort.MaxValue} {nameof(RpcQueueHistoryFrame)}s! Capping at {ushort.MaxValue} {nameof(RpcQueueHistoryFrame)}s.");
595595
}
596+
maxFrameHistory = ushort.MaxValue;
596597
}
597598

598599
ClearParameters();
@@ -684,9 +685,8 @@ private void Shutdown()
684685
this.UnregisterAllNetworkUpdates();
685686
}
686687

687-
bool isListening = !ReferenceEquals(m_NetworkManager, null) && m_NetworkManager.IsListening;
688-
//We need to make sure all internal messages (i.e. object destroy) are sent
689-
m_RpcQueueProcessor.InternalMessagesSendAndFlush(isListening);
688+
//We need to make sure any remaining internal messages are sent before completely shutting down.
689+
m_RpcQueueProcessor.InternalMessagesSendAndFlush(m_NetworkManager.IsListening);
690690

691691
//Dispose of any readers and writers
692692
foreach (var queueHistorySection in QueueHistory)

0 commit comments

Comments
 (0)