Conversation
Remove NetworkManager's authentication listener and stop the authenticator when NetworkServer.Listen throws, preserving external listeners and the original startup exception. Add regression tests for server and host startup failures, retry, and authenticator cleanup exceptions. Validated with Unity 2022.3.62f3: all 18 NetworkManager EditMode tests pass. The same tests against unmodified upstream fail in all three new regression cases. Change-Id: I1febc7820d8fbc65d91a33d0c9e3420ef09bfad6
This branch has not been deployed
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.
Problem
NetworkManager.SetupServer starts the authenticator and registers OnServerAuthenticated before calling NetworkServer.Listen. If Transport.ServerStart throws (for example, when its port is already in use), NetworkServer.active remains false. NetworkManager.StopServer then returns early, leaving the Manager's authentication listener installed and the authenticator without its matching OnStopServer call.
This is still present on master at c4f3739.
Change
Roll back the Manager-owned authentication listener and stop the authenticator when Listen throws. Preserve external event listeners and rethrow the original startup exception, even if authenticator cleanup also throws. This is deliberately limited to authentication rollback; it does not claim to perform complete transport rollback.
Regression coverage
Validation
Mirror.Tests.NetworkManagers: 18/18 passed with the patch.