Skip to content

fix: decoupling SessionManager from NetworkManager [MTT-2603] #581

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

Conversation

LPLafontaineB
Copy link
Contributor

Description

This PR removes dependencies that SessionManager had on NetworkManager, by removing it as a field and replacing the callbacks it registered to with public methods called from GameNetPortal. This solves the issues of the SessionManager not handling the destruction of the NetworkManager and the creation of a new one. In such a case, the SessionManager would have no idea it happened and would not unregister its callbacks and register them again on the new NetworkManager instance.

This PR also simplifies the handling of clearing data from disconnected players and reinitializing the rest when dealing with successive game sessions. We now simply do it when a session ends. Furthermore, a new field tells the SessionManager if a session is currently started, so that when a client disconnects it can decide if it needs to keep their data or not.

Issue Number(s)

MTT-2603

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • JIRA ticket ID is in the PR title or at least one commit message
  • Include the ticket ID number within the body message of the PR to create a hyperlink

* Removed NetworkManager field
* Removed callback registrations and replaced them with calls from GameNetPortal
@fernando-cortez fernando-cortez added 2-One More Review One review in, one to go and removed 1-Needs Review PR needs attention from the assignee and reviewers labels Mar 29, 2022
@LPLafontaineB LPLafontaineB added 1-Needs Review PR needs attention from the assignee and reviewers and removed 2-One More Review One review in, one to go labels Mar 31, 2022
@pdeschain pdeschain added the 2-Reviewed with Comments PR requires owner's attention label Apr 5, 2022
Copy link
Collaborator

@fernando-cortez fernando-cortez left a comment

Choose a reason for hiding this comment

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

Can approve once other conversations are resolved 👍.

@LPLafontaineB LPLafontaineB removed the 2-Reviewed with Comments PR requires owner's attention label Apr 5, 2022
@LPLafontaineB LPLafontaineB requested a review from pdeschain April 6, 2022 14:50
@LPLafontaineB LPLafontaineB removed the 1-Needs Review PR needs attention from the assignee and reviewers label Apr 6, 2022
@LPLafontaineB LPLafontaineB merged commit 297af21 into develop Apr 6, 2022
@LPLafontaineB LPLafontaineB deleted the fix/decoupling-session-manager-from-net-manager branch April 6, 2022 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-One More Review One review in, one to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants