refactor: NetworkMessageSystem (formerly MessagingSystem)#2505
Merged
refactor: NetworkMessageSystem (formerly MessagingSystem)#2505
NetworkMessageSystem (formerly MessagingSystem)#2505Conversation
…kMessageManager.StopProcessing`
0xFA11
commented
Apr 12, 2023
Comment on lines
-38
to
+70
| ConnectionManager.NetworkUpdate(updateStage); | ||
| { | ||
| ConnectionManager.OnEarlyUpdate(); | ||
| MessageManager.OnEarlyUpdate(); | ||
| } | ||
| break; | ||
| case NetworkUpdateStage.PreUpdate: | ||
| NetworkTimeSystem.NetworkUpdate(updateStage); | ||
| { | ||
| NetworkTimeSystem.NetworkUpdate(updateStage); | ||
| } | ||
| break; | ||
| case NetworkUpdateStage.PostLateUpdate: | ||
| ConnectionManager.NetworkUpdate(updateStage); | ||
| { | ||
| // This should be invoked just prior to the MessageManager processes its outbound queue. | ||
| SceneManager.CheckForAndSendNetworkObjectSceneChanged(); | ||
|
|
||
| // Process outbound messages | ||
| MessageManager.ProcessSendQueues(); | ||
|
|
||
| // Metrics update needs to be driven by NetworkConnectionManager's update to assure metrics are dispatched after the send queue is processed. | ||
| MetricsManager.UpdateMetrics(); | ||
|
|
||
| // TODO 2023-Q2: Determine a better way to handle this | ||
| NetworkObject.VerifyParentingStatus(); | ||
|
|
||
| // This is "ok" to invoke when not processing messages since it is just cleaning up messages that never got handled within their timeout period. | ||
| DeferredMessageManager.CleanupStaleTriggers(); | ||
|
|
||
| // TODO 2023-Q2: Determine a better way to handle this | ||
| if (m_ShuttingDown) | ||
| { | ||
| ShutdownInternal(); | ||
| } | ||
| } |
0xFA11
commented
Apr 12, 2023
Comment on lines
-204
to
-258
| /// <summary> | ||
| /// ConnectionManager Internal Updates | ||
| /// </summary> | ||
| internal void NetworkUpdate(NetworkUpdateStage updateStage) | ||
| { | ||
| switch (updateStage) | ||
| { | ||
| case NetworkUpdateStage.EarlyUpdate: | ||
| { | ||
| // Exit early if we haven't started or are no longer processing messages. | ||
| if (StopProcessingMessages) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| OnEarlyUpdate(); | ||
| MessagingSystem.OnEarlyUpdate(); | ||
|
|
||
| break; | ||
| } | ||
| case NetworkUpdateStage.PostLateUpdate: | ||
| { | ||
| // Things that should only be invoked when we are processing messages | ||
| if (!StopProcessingMessages) | ||
| { | ||
| // This should be invoked just prior to the MessagingSystem | ||
| // processes its outbound queue. | ||
| NetworkManager.SceneManager.CheckForAndSendNetworkObjectSceneChanged(); | ||
|
|
||
| // Process outbound messages | ||
| MessagingSystem.ProcessSendQueues(); | ||
|
|
||
| // Metrics update needs to be driven by NetworkConnectionManager's | ||
| // update to assure metrics are dispatched after the send queue is processed. | ||
| NetworkManager.NetworkMetricsManager.UpdateMetrics(); | ||
|
|
||
| // TODO 2023-Q2: Determine a better way to handle this | ||
| NetworkObject.VerifyParentingStatus(); | ||
| } | ||
|
|
||
| // This is "ok" to invoke when not processing messages since it is just cleaning | ||
| // up messages that never got handled within their timeout period. | ||
| NetworkManager.DeferredMessageManager.CleanupStaleTriggers(); | ||
|
|
||
| // TODO 2023-Q2: Determine a better way to handle this | ||
| if (NetworkManager.ShutdownInProgress) | ||
| { | ||
| NetworkManager.ShutdownInternal(); | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
0xFA11
commented
Apr 12, 2023
Comment on lines
-24
to
+34
| internal class MessagingSystem : IDisposable | ||
| internal class NetworkMessageManager : IDisposable |
NoelStephensUnity
approved these changes
Apr 12, 2023
Member
NoelStephensUnity
left a comment
There was a problem hiding this comment.
Smack-Pow-Boom!
Looks super-good to me!
👍 💯
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MessagingSystemtoNetworkMessageManagerNetworkMessageManagerout ofNetworkConnectionManagerNetworkConnectionManager.NetworkUpdate(...)entirely by inlining it intoNetworkManager.NetworkUpdate(...)(unrolling and flattening the nested flow)(No need for changelog entry since all changes were internal and no publicly visible changes made)