Skip to content

fix: cleaning up connected clients upon shutdown [MTT-1573] #1945

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

Merged
merged 4 commits into from
May 9, 2022

Conversation

jeffreyrainy
Copy link
Contributor

This cleans up the connected clients upon shutdown. Proper clean-up.

Doesn't change much for the customers, though, since recent Netcode for GameObjects would throw an exception, anyway, if trying to access connected clients while not hosting.

#416

@jeffreyrainy jeffreyrainy requested a review from 0xFA11 May 8, 2022 15:46
@jeffreyrainy jeffreyrainy requested a review from a team as a code owner May 8, 2022 15:46
Copy link
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog entry & tests?
also potentially backport to release/1.0.0 since it's not a breaking change?

@jeffreyrainy
Copy link
Contributor Author

changelog entry & tests? also potentially backport to release/1.0.0 since it's not a breaking change?

I'll have to push back a bit here. A changelog entry would be pretty useless.

When this issue was raised, client list would contain old information.
Current status, before change, is that trying to access this client list raises an exception.
After change, trying to access this client list raises the same exception. 🤷

Only improvement is internal data structure being cleaner and less error prone. Do we really want to changelog "Improved internal data handling" ?

Tests. Our current multi instance testing classes deal with hosting and joining, it would be cumbersome to test around this, and there wouldn't be much value anyway. I'd rather trust the code, after inspection and debugging through (which I did) than layer more test complexity.

For backport, certainly. As soon as this one is merged in, I'll add another backport PR.

@@ -1301,6 +1306,8 @@ internal void ShutdownInternal()
IsListening = false;
m_ShuttingDown = false;
m_StopProcessingMessages = false;

ClearClients();
Copy link
Contributor

@0xFA11 0xFA11 May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to answer your question, I'd like to ask a question here. wouldn't this change behavior such that connectedclients list(s) would be empty after stophost/client/server (aka shutdown) instead of (previously) containing stale data until we call Initialize() again?
I think that's the fix we're going for here with the JIRA ticket & this PR.
so, a changelog entry saying something like, "cleanup client lists on stophost/client/server" would be useful to know I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. done.

@jeffreyrainy jeffreyrainy requested a review from 0xFA11 May 9, 2022 19:52
@0xFA11 0xFA11 changed the title chore: cleaning up connected clients upon shutdown [MTT-1573] fix: cleaning up connected clients upon shutdown [MTT-1573] May 9, 2022
@0xFA11 0xFA11 enabled auto-merge (squash) May 9, 2022 19:57
@0xFA11 0xFA11 merged commit 4a5c86f into develop May 9, 2022
@0xFA11 0xFA11 deleted the chore/client-cleanup branch May 9, 2022 20:26
0xFA11 added a commit that referenced this pull request May 9, 2022
…1945) (#1949)

* chore: cleaning up connected clients upon shutdown [MTT-1573]

* chore: cleaning up connected clients upon shutdown [MTT-1573] changelog

* Update com.unity.netcode.gameobjects/CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants