diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-02-04 20:12:28 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2010-03-19 17:47:40 +0000 |
commit | aa275ff175180f9635c473bfb56912835aa488af (patch) | |
tree | 7a6635d7ff9b37716acdba213014de0938b3c1a8 | |
parent | bda156f52e377b4e8ad882de120ba94a1d3643b9 (diff) | |
download | dbus-aa275ff175180f9635c473bfb56912835aa488af.tar.gz |
Move dispatching to destination to bus_dispatch_matches()
-rw-r--r-- | bus/dispatch.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/bus/dispatch.c b/bus/dispatch.c index ae6971de..ca55177b 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -86,10 +86,28 @@ bus_dispatch_matches (BusTransaction *transaction, _dbus_assert (sender == NULL || bus_connection_is_active (sender)); _dbus_assert (dbus_message_get_sender (message) != NULL); + context = bus_transaction_get_context (transaction); + + /* First, send the message to the addressed_recipient, if there is one. */ + if (addressed_recipient != NULL) + { + if (!bus_context_check_security_policy (context, transaction, + sender, addressed_recipient, + addressed_recipient, + message, error)) + return FALSE; + + /* Dispatch the message */ + if (!bus_transaction_send (transaction, addressed_recipient, message)) + { + BUS_SET_OOM (error); + return FALSE; + } + } + + /* Now dispatch to others who look interested in this message */ connections = bus_transaction_get_connections (transaction); - dbus_error_init (&tmp_error); - context = bus_transaction_get_context (transaction); matchmaker = bus_context_get_matchmaker (context); recipients = NULL; @@ -289,24 +307,12 @@ bus_dispatch (DBusConnection *connection, { addressed_recipient = bus_service_get_primary_owners_connection (service); _dbus_assert (addressed_recipient != NULL); - - if (!bus_context_check_security_policy (context, transaction, - connection, addressed_recipient, - addressed_recipient, - message, &error)) - goto out; - - /* Dispatch the message */ - if (!bus_transaction_send (transaction, addressed_recipient, message)) - { - BUS_SET_OOM (&error); - goto out; - } } } - /* Now match the messages against any match rules, which will send - * out signals and such. addressed_recipient may == NULL. + /* Now send the message to its destination (or not, if + * addressed_recipient == NULL), and match it against other connections' + * match rules. */ if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error)) goto out; |