Skip to content

Commit e253952

Browse files
authored
fix: reserve all acl buffers for non-blocking l2cap (#317)
The non-blocking send version should request credits for all ACL packets to give same guarantees as before. The async version can ack 1 at a time and still provide the guarantees.
1 parent 23c6740 commit e253952

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

host/src/channel_manager.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,20 +595,21 @@ impl<'d> ChannelManager<'d> {
595595
};
596596

597597
// Pre-request
598+
let mut sender = ble.try_l2cap(conn, len, n_packets)?;
598599

599600
// Segment using mps
600601
let (first, remaining) = buf.split_at(buf.len().min(mps as usize - 2));
601602

602603
let len = encode(first, &mut p_buf[..], peer_cid, Some(buf.len() as u16))?;
603-
ble.try_l2cap(conn, (len - 4) as u16, 1)?.try_send(&p_buf[..len])?;
604+
sender.try_send(&p_buf[..len])?;
604605
grant.confirm(1);
605606

606607
let chunks = remaining.chunks(mps as usize);
607608
let num_chunks = chunks.len();
608609

609610
for (i, chunk) in chunks.enumerate() {
610611
let len = encode(chunk, &mut p_buf[..], peer_cid, None)?;
611-
ble.try_l2cap(conn, (len - 4) as u16, 1)?.try_send(&p_buf[..len])?;
612+
sender.try_send(&p_buf[..len])?;
612613
grant.confirm(1);
613614
}
614615
Ok(())

0 commit comments

Comments
 (0)