summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndreas Hindborg <andreas.hindborg@moveinnovation.dk>2021-04-09 15:23:02 +0200
committerAndreas Hindborg <andreas.hindborg@moveinnovation.dk>2021-04-12 21:10:33 +0200
commitb1f27afe3c6a7cd7a040dde3abfeea8746765827 (patch)
treed754003b4429398a0ea1b5cb229b0ff90802d20f /examples
parent68e8860d097c88c4b06382650cc0ee514f030aa3 (diff)
downloadnrf-softdevice-b1f27afe3c6a7cd7a040dde3abfeea8746765827.zip
fix: Fix an issue where SD L2Cap tx queue would overflow
If more L2Cap packets are queued than allocated at SoftDevice initialization time (ble_l2cap_conn_cfg_t::tx_queue_size), SoftDevice will throw an error. This patch updates Rust L2Cap wrapper Channel::tx to async yield if the tx queue is full.
Diffstat (limited to 'examples')
-rw-r--r--examples/src/bin/ble_l2cap_central.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/src/bin/ble_l2cap_central.rs b/examples/src/bin/ble_l2cap_central.rs
index 55ff261..179fff7 100644
--- a/examples/src/bin/ble_l2cap_central.rs
+++ b/examples/src/bin/ble_l2cap_central.rs
@@ -90,7 +90,7 @@ async fn ble_central_task(sd: &'static Softdevice) {
for i in 0..10 {
let mut v = Vec::with_capacity(Packet::MTU);
v.extend(&[i; Packet::MTU]);
- unwrap!(ch.tx(Packet(v)));
+ unwrap!(ch.tx(Packet(v)).await);
info!("l2cap tx done");
}
futures::future::pending::<()>().await;
@@ -98,6 +98,7 @@ async fn ble_central_task(sd: &'static Softdevice) {
use alloc::vec::Vec;
+#[derive(defmt::Format)]
struct Packet(Vec<u8>);
impl l2cap::Packet for Packet {
const MTU: usize = 512;