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

Fix connected_players on_shutdown #14739

Merged
merged 2 commits into from
Jun 15, 2024
Merged

Conversation

cx384
Copy link
Contributor

@cx384 cx384 commented Jun 8, 2024

Goal

Fixes #14736

How it works:

  • Reorderes what happens in Server::~Server().
    (It should be safe, to first stop the ServerThread before kicking the players, as far as I can tell.
    As before, the EmergeManager threads are stopped before the on_shutdown callback happens.)
  • Adds a test to devtest.
    (I'm not sure if I added it at the right place, but it is similar to the mods/unittests/load_time.lua file.)

To do

This PR is Ready for Review.

How to test

Start devtest and exit devtest.
(The test gets executed every time, similar to what happens in mods/unittests/load_time.lua.)

@Zughy Zughy added @ Script API Bugfix 🐛 PRs that fix a bug labels Jun 8, 2024
@SmallJoker
Copy link
Member

SmallJoker commented Jun 8, 2024

This looks good and works from what I've tested so far (that is: saving player metadata in the on_shutdown callback).

Would you please be so nice to mention this behaviour in the on_shutdown Lua API documentation? Suggestion:

* Players that were kicked by the shutdown procedure are still fully accessible
  in `minetest.get_connected_players()` .

@cx384
Copy link
Contributor Author

cx384 commented Jun 8, 2024

I added it to the on_shutdown Lua API documentation.

Copy link
Contributor

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

Tested, works. Code changes make sense. Thanks.

Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

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

seems ok

@appgurueu
Copy link
Contributor

@SmallJoker do you want to give this another look or test, or are you fine with it as-is?

@SmallJoker SmallJoker merged commit 7a64527 into minetest:master Jun 15, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_connected_players wrongly returns empty list in register_on_shutdown
5 participants