fix: scope bluez dbus match to bluezService (#3573)

Ensure the watcher only seees bluez messages

(cherry picked from commit 05377e690a)
This commit is contained in:
Marcus Ramberg
2026-10-07 12:58:50 -04:00
committed by bbedward
parent fd468a6b78
commit 8b34bbf71a
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -18,10 +18,12 @@ const (
propertiesIface = "org.freedesktop.DBus.Properties"
)
// Sender-scoped: the system bus is shared process-wide, so unscoped rules wake
// every other subsystem's signal channel too.
var bluezMatchRules = [][]dbus.MatchOption{
{dbus.WithMatchInterface(propertiesIface), dbus.WithMatchMember("PropertiesChanged")},
{dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesAdded")},
{dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesRemoved")},
{dbus.WithMatchSender(bluezService), dbus.WithMatchInterface(propertiesIface), dbus.WithMatchMember("PropertiesChanged")},
{dbus.WithMatchSender(bluezService), dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesAdded")},
{dbus.WithMatchSender(bluezService), dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesRemoved")},
}
func NewManager() (*Manager, error) {
+1 -1
View File
@@ -19,7 +19,7 @@ func WaitForAdapter() error {
conn.Signal(signals)
defer conn.RemoveSignal(signals)
adapterAdded := []dbus.MatchOption{dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesAdded")}
adapterAdded := []dbus.MatchOption{dbus.WithMatchSender(bluezService), dbus.WithMatchInterface(objectMgrIface), dbus.WithMatchMember("InterfacesAdded")}
if err := conn.AddMatchSignal(adapterAdded...); err != nil {
return err
}