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

[Feature Request] add ability to discard a message from a message buffer #268

Open
galenseitz opened this issue Mar 2, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@galenseitz
Copy link

If a message sender writes a message that is longer than the receiver is expecting to handle, there is no way to discard the message other than to perform a message buffer reset. Of course, a message buffer reset will discard all messages, not just the message with the problematic length. For more robust error recovery, I think it would be useful to have a way to discard a message without requiring a buffer large enough to hold whatever message may be sent.

I suggest adding a new function like xMessageBufferDiscard(MessageBufferHandle_t xMessageBuffer, TickType_t xTicksToWait ). (I'm unsure whether a timeout param is appropriate here.) Alternatively, and perhaps better, would be to allow xMessageBufferReceive to discard a message if the pvRxData parameter is NULL.

For the time being, I will probably change my sending code to prevent messages that are too long. I will also issue a message buffer reset if a too long message is received.

See the forum discussion here

@galenseitz galenseitz added the enhancement New feature or request label Mar 2, 2021
@FedericoSoberanes
Copy link

Ran into the same issue when I tryed to implement a message fifo. There is no way to discard old messages to make space for new ones directly, in my situation available ram is not an issue but reading and copying the message just for discarding it seems wastefull when the solution seems pretty easy like passing null in pointer or implement a new "discard" function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants