Skip to content

Fix: Short packets panic over TCP#290

Merged
sorokya merged 1 commit intomasterfrom
fix-tcp-read-panic
Apr 16, 2026
Merged

Fix: Short packets panic over TCP#290
sorokya merged 1 commit intomasterfrom
fix-tcp-read-panic

Conversation

@sorokya
Copy link
Copy Markdown
Owner

@sorokya sorokya commented Apr 16, 2026

This pull request improves error handling and reporting for short or invalid packets received over the network, and refines error messages when closing a player connection. The main changes are:

Error Handling and Reporting:

  • In PacketBus, when a binary message is received that is too short (less than 4 bytes), the code now returns a detailed InvalidData error instead of silently returning None. This makes it easier to diagnose protocol issues.
  • Similarly, when reading from the packet stream, if the buffer is too short (less than 3 bytes), a descriptive InvalidData error is returned, improving debugging and robustness.

Player Error Messaging:

  • In run_player (in player_handle.rs), when an unknown error occurs, the error message logged when closing the connection now only includes the error itself, rather than a prefixed message. This results in clearer and more direct error reporting.

@sorokya sorokya merged commit c8f7c29 into master Apr 16, 2026
10 checks passed
@sorokya sorokya deleted the fix-tcp-read-panic branch April 16, 2026 01:15
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