Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PacketBuffer ringbuf size #6800

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

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

dhalbert
Copy link
Collaborator

Ringbuf for a fixed-size PacketBuffer was one byte too small.

I have a better cleanup for ringbuf which will also fix this problem in #6214, but it was a big change which I deferred to main and then forgot to add after doing #6238 instead for 7.x.x. I will make another PR for main that incorporates the fixes from #6214.

@dhalbert dhalbert requested a review from jepler August 23, 2022 23:45
Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively makes sense, but feels like it could use actual testing as well.

A tiny slice of me thinks maybe the buffer should be 1 element bigger, not 1 byte bigger, because maybe otherwise uint16_ts get split or misaligned once the ringbuffer wraps around

@dhalbert
Copy link
Collaborator Author

I have a much better fix in #6214, which was closed because it was too dangerous to incorporate in a 7.3.x point release. But I opened #6815 to remind me to bring in the #6214 changes to main. You had one concern about #6214 not being atomic in certain ways, but ringbuf's uses do not assume atomicity.

I think the byte vs 16-bit int does not make a difference for this PacketBuffer case.

@dhalbert
Copy link
Collaborator Author

I did test this with the #6786 tests.

@dhalbert dhalbert merged commit 59af865 into adafruit:7.3.x Aug 25, 2022
@dhalbert dhalbert deleted the PacketBuffer-ringbuf-size branch August 25, 2022 12:35
@dhalbert dhalbert linked an issue Aug 28, 2022 that may be closed by this pull request
@dhalbert dhalbert mentioned this pull request Sep 16, 2022
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.

ToneService inoperative on Clue?
2 participants