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

Synchronize packet encoding #995

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

booky10
Copy link
Collaborator

@booky10 booky10 commented Sep 17, 2024

Resolves concurrency issues which may happen when sending the same packet wrapper to different players, concurrently

This is not a perfect solution, but the alternative would be refactoring the packetwrapper to be based on buffers passed during encoding as parameters, which would be too much effort and would require breaking changes

Fixes #991

Resolves concurrency issues which may happen when sending the same packet wrapper to different players, concurrently

This is not a perfect solution, but the alternative would be refactoring the packetwrapper to be based on buffers passed during encoding as parameters, which would be too much effort and would require breaking changes
@retrooper
Copy link
Owner

My question would be why you didn't opt for the Java Lock class?

@booky10
Copy link
Collaborator Author

booky10 commented Sep 20, 2024

I don't see a reason to use locks when we can just use synchronized
If you would prefer locks I can change this logic to use locks, but that should not make a difference

@retrooper retrooper merged commit cb277bf into retrooper:2.0 Sep 20, 2024
2 checks passed
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.

Race condition when sending same packet concurrently
2 participants