Skip to content

Commit

Permalink
[AsyncCAN] Handle RecvError::Lagged
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Apr 1, 2024
1 parent 65e8465 commit 2051824
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/can/async_can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::can::Frame;
use crate::can::Identifier;
use crate::Stream;
use async_stream::stream;
use tokio::sync::broadcast::error::RecvError;
use tokio::sync::{broadcast, mpsc, oneshot};
use tracing::debug;

Expand Down Expand Up @@ -142,11 +143,12 @@ impl AsyncCanAdapter {
Ok(frame) => {
if filter(&frame) {
yield frame
} else {
continue
}
}
Err(_) => continue,
},
Err(RecvError::Closed) => panic!("Adapter thread has exited"),
Err(RecvError::Lagged(n)) => {
tracing::warn!("Receive too slow, dropping {} frame(s).", n)
},
}
}
})
Expand Down

0 comments on commit 2051824

Please sign in to comment.