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 all the nasty stuff #319

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Fix all the nasty stuff #319

merged 1 commit into from
Nov 7, 2024

Conversation

Endogen
Copy link
Contributor

@Endogen Endogen commented Nov 7, 2024

Fixed Incomplete Data Reads in Simulator and Node

Simulator (listen method)

  • Updated the data reading logic to ensure that all expected bytes are read from the socket before processing.
  • Implemented a loop to accumulate incoming data until the total received bytes match the expected message length.

Node

  • Adjusted the data reading mechanism when communicating with the simulator to read all expected data.
  • Added a loop to continuously read data until the expected length is met, ensuring complete data reception before processing.

Adjusted JSON Parsing in Simulator:

  • Modified the simulator to parse JSON directly from bytes without first decoding to a string.
  • Ensured compatibility and correct parsing of the payload by handling bytes directly.

Improved Handling of Incomplete Messages in read_messages Function

  • Updated the read_messages function to handle incomplete data reads gracefully.
  • Instead of treating incomplete messages as errors, the function now waits for more data to arrive, improving reliability during normal operation.

Modified _handler Method in ABCIServer

  • Adjusted the buffer management in the _handler method to correctly handle incoming data.
  • Removed processed data from the buffer after each iteration to prevent buffer overflow.
  • Ensured that incomplete messages are handled without logging errors, enhancing performance and stability.

Removed Unnecessary Error Logging:

  • Eliminated error messages that were being logged due to incomplete data reads, which are expected in socket communication.
  • Improved log clarity by only logging actual errors, reducing noise and aiding in troubleshooting.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have performed a self-review of my own code
  • I have tested this change in my development environment.
  • I have added tests to prove that this change works
  • All existing tests pass after this change
  • I have added / updated documentation related to this change

@duelingbenjos duelingbenjos self-requested a review November 7, 2024 02:12
@Endogen Endogen self-assigned this Nov 7, 2024
@Endogen Endogen added the bug Something isn't working label Nov 7, 2024
@Endogen Endogen merged commit 5302fac into master Nov 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants