From b3bfdcdd1bcdbd64aec4bfd5163a053db9829442 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Tue, 16 Aug 2016 20:28:26 +0900 Subject: [PATCH] modify signal subscription rule Change-Id: I8ab485f0a59e041ef735ff8cc74909cf9b7db91f Signed-off-by: sanghyeok.oh --- gio/gdbusconnection.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 81f2d9a..67edf97 100755 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -4398,28 +4398,29 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection, /* rule for special message */ if (!signal_data->sender_unique_name || g_strcmp0 (signal_data->sender_unique_name, "org.freedesktop.DBus") == 0) { - if (!signal_data->interface_name || g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0) + if (signal_data->sender_unique_name) + special_rule = TRUE; + if (!signal_data->object_path || g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0) { - if (!signal_data->object_path || g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0) + if (!signal_data->interface_name || g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0) { /* By https://dbus.freedesktop.org/doc/dbus-specification.html, org.freedesktop.DBus * has three signal types: NameAcquired, NameLost, NameOwnerChanged (all covered below). * - * 1. if every paramether is NULL then we will add both 'special rule' and 'standard rule' - * - (NULL, NULL, NULL, NULL or NameAcquired or NameLost or NameOwnerChanged) + * 1. if sender is NULL and other parameters are matched with special rule, add BOTH special and standard, + * - (NULL, NULL or DBUS, NULL or DBUS, NULL or Special Name) * - * 2. if (sender or interface or path) is "null or org.freedesktop.DBus" and member is special name, - * then we will add special rule. - * - (org.freedesktop.DBus, NULL, NULL, NameAcquired or NameLost or NameOwnerChanged) + * if other parameters are NOT matched with special rule, add standard rule + * - (NULL, X, X, "NotSpecial") * - * 2-1) if (sender or interface or path) is "null or org.freedesktop.DBus", and member is NOT special name, - * then we will ignore it. - * - (org.freedesktop.DBus, NULL, NULL, "NotSpecial") + * 2. if sender is 'org.freedesktop.DBus' and other parameters are matched with special rule, add special rule + * - (org.freedesktop.DBus, NULL or DBUS, NULL or DBUS, NULL or Special Name) + * + * if other parameters are NOT matched with special rule, then ignore + * - (org.freedesktop.DBus, X, X, "NotSpecial") * * for every other cases, add standard rule, */ - if (signal_data->sender_unique_name || signal_data->interface_name || signal_data->object_path) - special_rule = TRUE; if (g_strcmp0 (signal_data->member, "NameAcquired") == 0) _g_kdbus_subscribe_name_acquired (connection->kdbus_worker, signal_data->rule, arg0, NULL); -- 2.7.4