Report the loss of the AdvertisementMonitor's D-Bus connection - #84
Open
Kinchul wants to merge 3 commits into
Open
Report the loss of the AdvertisementMonitor's D-Bus connection#84Kinchul wants to merge 3 commits into
Kinchul wants to merge 3 commits into
Conversation
…nection The monitor exports a DBus object, which Tmds.DBus only allows on a manual connection, and a manual connection never reconnects: after a bus restart BlueZ has dropped the monitor and no DeviceFound or DeviceLost is ever raised again. The connection is private, so a consumer had no way to notice. ConnectionLost reports it so the monitor can be disposed and re-created; recovery stays the consumer's decision, as the object cannot be revived in place.
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.
Why
AdvertisementMonitorexports a D-Bus object, and Tmds.DBus only allows that on a manualconnection —
RegisterObjectAsyncthrows for anAutoConnectone. A manual connection neverreconnects, and
ConnectAsyncrefuses to run twice.So after a bus restart (
systemctl restart dbus) the monitor is permanently dead: BlueZ hasdropped the registration, no
DeviceFoundEventorDeviceLostEventis ever raised again, andnothing is logged. The connection is private, so a consumer has no way to detect it. We hit
this as passive monitoring silently stopping until the process was restarted.
What changed
ConnectionLostevent onAdvertisementMonitor, raised when its connection drops.Disposenow also closes that connection. Each monitor owns one, so a monitor droppedwithout disposing leaked its socket until finalization.
The library does not attempt recovery: the object cannot be revived in place, so recreating it
is the consumer's decision. The event exists so that decision can be made at all.