Bluetooth: host: Fix disconnect priority event handling
Fix issue is host handling of connected and disconnected event. Since the host wants the disconnected event to be processed as a priority event as well as in reguler event context while the connected event is always in reguler event context we can end up in a situation where the disconnected priority event is processed before the connected event. Since the disconnected priority event is there to release unack'ed TX pending on the connection in case the RX thread is blocked waiting for TX resources, we need to keep this behavior. Otherwise this would be a potential deadlock of the RX thread waiting for resources that can only be released by the RX thread. When this situation happens we know that there cannot be any pending TX on this connection so we can safely skip releasing of unack'ed TX. The second thing the disconnected priority event does is marking the TX path on the connection as disconnected. We need to do the same in this situation, so we make sure that the TX path is already marked disconnected when providing the connected callback to the application. This fixes a regression from 4be66bd3. Signed-off-by:Joakim Andersson <joakim.andersson@nordicsemi.no>
Loading
Please sign in to comment