jonas-schievink / rubble

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

Responder should shut down after connection terminates #70

Open jonas-schievink opened 5 years ago

jonas-schievink commented 5 years ago

Right now, when the link-layer connection is terminated, the packet queues might still contain data the responder will then still try to process. This might even "succeed" until the sending queue fills up. We should try to clear the queues and signal that the connection has shut down.

jonas-schievink commented 5 years ago

Looks like I thought about this in https://github.com/jonas-schievink/rubble/issues/26 already, but never implemented it:

For LL_TERMINATE_IND I think we'll want to quit the connection state and send the PDU through the channel, allowing the non-realtime part to later invoke a user callback.

This is not enough though, since the termination PDU will not be processed if the tx queue is full.