Skip to content

Commit

Permalink
feat(frame): add handling of non-empty frame recorders before sending
Browse files Browse the repository at this point in the history
  • Loading branch information
Kay Grewe authored and Kay Grewe committed May 22, 2024
1 parent 3df08a3 commit 488e085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rodbus/src/serial/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub(crate) fn format_rtu_pdu(
msg.serialize(cursor, Some(&mut records))?;

if !records.records_empty() {
//TODO(Kay): We need to inform the user about a forgotten empty lonely byte :( (NOTE: Only user of this API is probably me but whatever :) )
return Err(RequestError::FrameRecorderNotEmpty)
}
let end_pdu_body = cursor.position();
// Write the CRC
Expand Down
2 changes: 1 addition & 1 deletion rodbus/src/tcp/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub(crate) fn format_mbap(
msg.serialize(cursor, Some(&mut records))?;

if !records.records_empty() {
//TODO(Kay): Again we need to pass this error up !
return Err(RequestError::FrameRecorderNotEmpty)
}
let end_pdu = cursor.position();

Expand Down

0 comments on commit 488e085

Please sign in to comment.