Description
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