Skip to content

Report the loss of the AdvertisementMonitor's D-Bus connection - #84

Open
Kinchul wants to merge 3 commits into
SuessLabs:developfrom
fiveco:vk/advmonitor-connection-lost
Open

Report the loss of the AdvertisementMonitor's D-Bus connection#84
Kinchul wants to merge 3 commits into
SuessLabs:developfrom
fiveco:vk/advmonitor-connection-lost

Conversation

@Kinchul

@Kinchul Kinchul commented Aug 7, 2026

Copy link
Copy Markdown

Why

AdvertisementMonitor exports a D-Bus object, and Tmds.DBus only allows that on a manual
connection — RegisterObjectAsync throws for an AutoConnect one. A manual connection never
reconnects, and ConnectAsync refuses to run twice.

So after a bus restart (systemctl restart dbus) the monitor is permanently dead: BlueZ has
dropped the registration, no DeviceFoundEvent or DeviceLostEvent is ever raised again, and
nothing 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

  • ConnectionLost event on AdvertisementMonitor, raised when its connection drops.
  • Dispose now also closes that connection. Each monitor owns one, so a monitor dropped
    without 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.

DamianSuess and others added 3 commits May 11, 2026 08:44
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants