fix: guard ViaVersion packet sends by connection state#134
Conversation
|
Example stacktrace of what this fixes: https://pastebin.com/ArSiLfef (connecting a player while simultaniously disconnecting the existing player through velocity + floodgate) |
|
Should this check also be done when using the ViaAPI#sendRawPacket API in LegacyTeamDisplayPacketAdapter? |
Good catch, tbh I haven't looked at anything besides the ModernPacketSender, because that was the only thing causing issues for us. I'll update the PR shortly. |
|
I've refactored the checks into its own class and added it to the LegacyTeamDisplayPacketAdapter too now |
|
Thanks You didn't need to be so paranoid about releasing the packet buffer, it's allocated on the heap and will be freed by GC |
Better safe than sorry^^ thanks for merging! |
Prevents scoreboard packets from being written through ViaVersion when the player's connection is no longer ready to accept play packets.
This covers race conditions where a player disconnects, enters the configuration phase, or reconnects while a packet write is queued.
(For example when a player connects with the same UUID from another client, or when floodgate account linking is active and they connect with Bedrock while online with Java)