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 race condition #629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

BurntRanch
Copy link

@BurntRanch BurntRanch commented Nov 20, 2023

There is a race condition before the variables are made where the update function runs before the rest of the code is initialized.
First, yes, here is proof of the crash.
image

Second, CustomFPC is not the reason, this is the code for CustomFPC, it calls super().__init__() which runs FirstPersonController's __init__ function and the rest is handled by FirstPersonController.

class customFPC(FirstPersonController):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
    def input(self, key):
        super().input(key)
        playerID = decodedGameToken[0]
        if playerID in gameState['PLAYERS'] and key == 'left mouse down':
            server.send(server.connections[0], b'FIRE\x00' + serverToken.encode('ascii'))

Last, if setting the self.enabled to False also works, its better to do that, I just couldn't replicate this race condition to test that.

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.

1 participant