microRTPS: transport: hotfix to skip data packets that that don't fit the buffer and continue the readings

This commit is contained in:
TSC21 2020-07-16 19:05:25 +01:00 committed by Nuno Marques
parent 25d2236cce
commit 407bd8860f
1 changed files with 4 additions and 0 deletions

View File

@ -167,6 +167,10 @@ ssize_t Transport_node::read(uint8_t *topic_ID, char out_buffer[], size_t buffer
// The message won't fit the buffer.
if (buffer_len < header_size + payload_len) {
// drop the message an continue the readings
// @note: this is just a work around to avoid the link to be closed
memmove(rx_buffer, rx_buffer + msg_start_pos + 1, rx_buff_pos - (msg_start_pos + 1));
rx_buff_pos = rx_buff_pos - (msg_start_pos + 1);
return -EMSGSIZE;
}