-
Notifications
You must be signed in to change notification settings - Fork 459
fix: Ensure NetworkConnectionManager correctly handles multiple disconnect messages being sent #3707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EmandM
wants to merge
8
commits into
develop-2.0.0
Choose a base branch
from
fix/transport-double-disconnect
base: develop-2.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix: Ensure NetworkConnectionManager correctly handles multiple disconnect messages being sent #3707
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
358e353
fix: Ensure NetworkConnectionManager correctly handles multiple disco…
EmandM 151c8f1
small fixes
EmandM 37ee6a7
update CHANGELOG
EmandM 54dcb4d
Remove debug logs and fix xml doc
EmandM 7ab8c3c
Update CHANGELOG with info for #3647
EmandM 1373154
Undo update to CHANGELOG
EmandM 61c7e5b
Merge branch 'develop-2.0.0' of https://github.com/Unity-Technologies…
EmandM 1d9cf5f
Merge branch 'develop-2.0.0' into fix/transport-double-disconnect
EmandM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
413 changes: 226 additions & 187 deletions
413
com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
47 changes: 47 additions & 0 deletions
47
com.unity.netcode.gameobjects/Tests/Runtime/Transports/TransportTests.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Collections; | ||
using NUnit.Framework; | ||
using Unity.Netcode.TestHelpers.Runtime; | ||
using UnityEngine.TestTools; | ||
|
||
namespace Unity.Netcode.RuntimeTests | ||
{ | ||
[TestFixture(HostOrServer.Server)] | ||
[TestFixture(HostOrServer.Host)] | ||
internal class TransportTests : NetcodeIntegrationTest | ||
{ | ||
protected override int NumberOfClients => 2; | ||
|
||
protected override bool m_UseMockTransport => true; | ||
|
||
public TransportTests(HostOrServer hostOrServer) : base(hostOrServer) { } | ||
|
||
[UnityTest] | ||
public IEnumerator MultipleDisconnectEventsNoop() | ||
{ | ||
var clientToDisconnect = GetNonAuthorityNetworkManager(0); | ||
var clientTransport = clientToDisconnect.NetworkConfig.NetworkTransport; | ||
|
||
var otherClient = GetNonAuthorityNetworkManager(1); | ||
|
||
// Send multiple disconnect events | ||
clientTransport.DisconnectLocalClient(); | ||
clientTransport.DisconnectLocalClient(); | ||
|
||
// completely stop and clean up the client | ||
yield return StopOneClient(clientToDisconnect); | ||
|
||
var expectedConnectedClients = m_UseHost ? NumberOfClients : NumberOfClients - 1; | ||
yield return WaitForConditionOrTimeOut(() => otherClient.ConnectedClientsIds.Count == expectedConnectedClients); | ||
AssertOnTimeout($"Incorrect number of connected clients. Expected: {expectedConnectedClients}, have: {otherClient.ConnectedClientsIds.Count}"); | ||
|
||
// Start a new client to ensure everything is still working | ||
yield return CreateAndStartNewClient(); | ||
|
||
var newExpectedClients = m_UseHost ? NumberOfClients + 1 : NumberOfClients; | ||
yield return WaitForConditionOrTimeOut(() => otherClient.ConnectedClientsIds.Count == newExpectedClients); | ||
AssertOnTimeout($"Incorrect number of connected clients. Expected: {newExpectedClients}, have: {otherClient.ConnectedClientsIds.Count}"); | ||
|
||
|
||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
com.unity.netcode.gameobjects/Tests/Runtime/Transports/TransportTests.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.