Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions linux-rust/src/bluetooth/aacp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,11 +1191,23 @@ async fn recv_thread(manager: AACPManager, sp: Arc<SeqPacket>) {

async fn send_thread(mut rx: mpsc::Receiver<Vec<u8>>, sp: Arc<SeqPacket>) {
while let Some(data) = rx.recv().await {
if let Err(e) = sp.send(&data).await {
error!("Failed to send data: {}", e);
break;
let mut attempts = 0;
loop {
match sp.send(&data).await {
Ok(_) => {
debug!("Sent {} bytes: {}", data.len(), hex::encode(&data));
break;
}
Err(e) if e.raw_os_error() == Some(107) && attempts < 10 => {
attempts += 1;
sleep(Duration::from_millis(100)).await;
}
Err(e) => {
error!("Failed to send data: {}", e);
return;
}
}
}
debug!("Sent {} bytes: {}", data.len(), hex::encode(&data));
}
info!("Send thread finished.");
}