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

Player: Separate disconnection logic into disconnect() API method #2318

Closed
wants to merge 3 commits into from

Conversation

@dktapps
Copy link
Member

commented Jul 22, 2018

Introduction

close() should NOT be used by plugins anymore.

disconnect() will do the logic that won't cause things to crash. close() will handle breaking cyclic references and cleanup only.

This fixes a multitude of bugs relating to player kicking and closing during events. This fixes #1239 and a range of other related (but not reported on the issue tracker) bugs.

Relevant issues

#1239

Changes

API changes

  • Added new API method Player->disconnect().
  • Player->close() should now be considered internal, and should not be used.

Behavioural changes

None known.

Backwards compatibility

This breaks backwards compatibility by changing the use and functionality of Player->close(). It should perhaps be made private, but this isn't currently possible due to limitations in how entity deletion works.

Follow-up

  • Clean up generic Entity deletion in this fashion.
  • Make Player only be constructed when the login sequence is completed, to remove the mess of incomplete players.

Tests

Transferring, kicking and disconnecting during PlayerInteractEvent and PlayerAnimateEvent have been tested, amongst other things.

close() should NOT be used by plugins anymore.

disconnect() will do the logic that won't cause things to crash. close() will handle breaking cyclic references and cleanup only.

This fixes a multitude of bugs relating to player kicking and closing during events. This fixes #1239 and a range of other related (but not reported on the issue tracker) bugs.
@dktapps

This comment has been minimized.

Copy link
Member Author

commented Jul 22, 2018

I also considered other ways to solve this, such as the discussed exception throws, but this appears to be the least BC-breaking way to solve it.

@dktapps

This comment has been minimized.

Copy link
Member Author

commented Jul 22, 2018

Apparently the server will crash when a player is kicked due to login timeout. 🙄

@dktapps

This comment has been minimized.

Copy link
Member Author

commented Jul 22, 2018

Going to put this on hold, since it requires a bunch of hacks because of the mess of Player construction.

@SOF3 SOF3 self-requested a review Jul 28, 2018
@dktapps

This comment has been minimized.

Copy link
Member Author

commented Aug 6, 2018

Closing this since it can't be merged yet and has conflicts with the base branch. When the time comes it'll be simpler to rewrite it.

@dktapps dktapps closed this Aug 6, 2018
@dktapps dktapps deleted the disconnect-rework branch Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.