jonas-schievink / rubble

(going to be a) BLE stack for embedded Rust
BSD Zero Clause License
397 stars 56 forks source link

Spinning on the responder can hang when the outgoing queue is full #85

Open jonas-schievink opened 4 years ago

jonas-schievink commented 4 years ago

The example uses code like this:

while resources.BLE_R.has_work() {
    resources.BLE_R.process_one().unwrap();
}

This code can spin forever when the queue of outgoing packets is full and doesn't get drained asynchronously.

Responder should probably get a method process_all() that takes this into account. We also have to ensure that the BLE worker gets rescheduled when a packet gets dequeued from the TX queue, not just when one gets enqueued into the RX queue.