Skip to content

Commit

Permalink
mcu-util: remove useless Arc
Browse files Browse the repository at this point in the history
give ownership to blocking thread
  • Loading branch information
fouge committed May 7, 2024
1 parent 2c6d491 commit d7acf56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mcu-util/src/messaging/can/isotp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use prost::Message;
use std::io::{Read, Write};
use std::process;
use std::sync::atomic::{AtomicU16, Ordering};
use std::sync::{mpsc, Arc};
use std::sync::mpsc;
use tokio::time::Duration;
use tracing::{debug, error};

Expand Down Expand Up @@ -142,7 +142,7 @@ impl CanIsoTpMessaging {
}
}

async fn send_wait_ack(&mut self, frame: Arc<Vec<u8>>) -> Result<CommonAckError> {
async fn send_wait_ack(&mut self, frame: Vec<u8>) -> Result<CommonAckError> {
let mut stream = self.stream.try_clone()?;
tokio::task::spawn_blocking(move || {
if let Err(e) = stream.write(frame.as_slice()) {
Expand Down Expand Up @@ -258,6 +258,6 @@ impl MessagingInterface for CanIsoTpMessaging {
_ => return Err(eyre!("Invalid payload")),
};

self.send_wait_ack(Arc::new(bytes)).await
self.send_wait_ack(bytes).await
}
}

0 comments on commit d7acf56

Please sign in to comment.