-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
log_streaming: make it robust to message drops #2290
Conversation
When a message is dropped, we need to discard any message part. Otherwise, we end up having corrrupt ulog files. Signed-off-by: Julian Oes <julian@oes.ch>
|
@bkueng would be great if you could check I got this right. |
I believe this is better than what's in main, so I'm merging it now before the next release. |
_ulog_data.insert( | ||
_ulog_data.end(), | ||
logging_data_acked.data + logging_data_acked.first_message_offset, | ||
logging_data_acked.data + logging_data_acked.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you must only insert if there's a valid offset: logging_data_acked.first_message_offset != std::numeric_limits<uint8_t>::max()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right!
switch (drop_state) { | ||
case DropState::Ok: | ||
if (logging_data_acked.first_message_offset == std::numeric_limits<uint8_t>::max()) { | ||
_ulog_data.insert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a dropout you must first wait for a valid logging_data_acked.first_message_offset
before inserting in _ulog_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So I need to keep track of the previous state. Or rather set if there was a valid one.
When a message is dropped, we need to discard any message part. Otherwise, we end up having corrrupt ulog files.