Skip to content

Commit

Permalink
change into debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Mar 28, 2024
1 parent 9bb1caa commit 9d4efdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/can/async_can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ fn process<T: CanAdapter>(
}
if !buffer.is_empty() {
adapter.send(&mut buffer).unwrap();

if !buffer.is_empty() {
debug!("Failed to send all frames, requeueing {} frames", buffer.len());

}
}
std::thread::sleep(std::time::Duration::from_millis(1));
}
Expand Down
4 changes: 2 additions & 2 deletions src/socketcan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ impl CanAdapter for SocketCan {
while let Some(frame) = frames.pop_front() {
let to_send: socketcan::frame::CanAnyFrame = frame.clone().into();

if let Err(e) = self.socket.write_frame(&to_send) {
tracing::warn!("Failed to send frame {:?}", e);
if let Err(_) = self.socket.write_frame(&to_send) {
// Failed to send frame, push it back to the front of the queue for next iteration
frames.push_front(frame);
break;
}
Expand Down

0 comments on commit 9d4efdd

Please sign in to comment.