Skip to content
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

Issue/#707 fix disconnect handlers not always triggering #708

Merged

Conversation

Askaholic
Copy link
Collaborator

This one's slightly more meaty than my recent PR's :)

I refactored on_connection_lost so it is triggered from ServerContext for all services whenever a connection closes or is forcibly closed. It seems like there was some cleanup code that was duplicated in LobbyConnection.abort and LobbyConnection.on_connection_lost which had gotten out of sync at some point meaning that if a player's connection was closed via abort, then the disconnect logic in LadderService and PartyService would not be triggered. This was causing some old Player objects to outlive their LobbyConnection's and causing the self.player is not party.owner check to fail. Therefore, I've also refactored that check to use == comparison instead of is.

Closes #707

@Askaholic Askaholic force-pushed the issue/#707-logout-cleanup-functions branch from e922e18 to 32aa191 Compare January 30, 2021 05:05
Copy link
Member

@cleborys cleborys left a comment

Choose a reason for hiding this comment

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

Needs a rebase now (sorry I'm slow)



@fast_forward(30)
async def test_party_cleanup_on_abort(lobby_server):
Copy link
Member

Choose a reason for hiding this comment

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

What is the implicit "assert" here? If it's not properly cleaned up then the second time the start command for tmm fails and waiting for search_info times out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep exactly. If the party isn't cleaned up, then you'd get a notice message instead of search_info.

I think I should also specify that state="start" in the search_info message.

@Askaholic Askaholic force-pushed the issue/#707-logout-cleanup-functions branch from 32aa191 to f3466ab Compare February 2, 2021 00:19
This enforces consistency accross all disconnect handlers and allows the
ServerContext to ensure that every disconnect handler is called.
@Askaholic Askaholic force-pushed the issue/#707-logout-cleanup-functions branch from f3466ab to 85f2482 Compare February 2, 2021 00:33
@Askaholic Askaholic merged commit ba6291b into FAForever:develop Feb 3, 2021
@Askaholic Askaholic deleted the issue/#707-logout-cleanup-functions branch February 3, 2021 05:37
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.

Some cleanup code is not triggered when using LobbyConnection.abort
2 participants