Ignore disconnect callbacks before first successful connection#119
Open
eputtone wants to merge 1 commit into
Open
Ignore disconnect callbacks before first successful connection#119eputtone wants to merge 1 commit into
eputtone wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Linux/BlueZ, disconnect callbacks can occur during failed connection attempts before a stable connection is established.
Currently, these callbacks call
stop_loop()unconditionally. That can cause the application to shut down prematurely even if a subsequent connection attempt succeeds.This change ignores disconnect callbacks until after the first successful connection has completed, while preserving the existing behavior for disconnects after connection.
Example
Raspberry Pi 3+ / Broadcom chip (BCM4345C0) / Raspberry Pi OS Lite 13 when running
ble_serialover Wifi + SSH. The problem does not occur when using cable connection.Before the suggested change:
With the proposed change:
Related
btmonlog. Due to radio interference from WIFI or poor coordination between BlueZ + brcmfmac, establishing the connection fails atConnection Failed to be Established (0x3e). But with large enough timeout, connection will eventually succeed.