Skip to content

Fix race condition#629

Open
BurntRanch wants to merge 1 commit into
pokepetter:masterfrom
BurntRanch:patch-3
Open

Fix race condition#629
BurntRanch wants to merge 1 commit into
pokepetter:masterfrom
BurntRanch:patch-3

Conversation

@BurntRanch
Copy link
Copy Markdown

@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