summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-09-07 14:54:34 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2020-09-15 08:05:24 +0200
commitf17500cc781d2ca170c173b2405f8410eaa94e78 (patch)
treeb6cbe744314f687edfdb591e32b9a4482b054770
parent818cae4f6ec7825ed7f4c49ed0d04a08e552b1ec (diff)
downloaddbus-f17500cc781d2ca170c173b2405f8410eaa94e78.tar.gz
dbus-f17500cc781d2ca170c173b2405f8410eaa94e78.tar.bz2
dbus-f17500cc781d2ca170c173b2405f8410eaa94e78.zip
cynara integration: create deferred message only when it's not already created
This will allow altering existing deferred messages, enabling concurrent asynchronous cynara checks for SEND and RECEIVE. Change-Id: I1f31c173e4229661bca9f14ecaa158ee67342db4
-rw-r--r--bus/cynara.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/bus/cynara.c b/bus/cynara.c
index 8d4d50a1..98255cd5 100644
--- a/bus/cynara.c
+++ b/bus/cynara.c
@@ -153,6 +153,9 @@ bus_cynara_check_privilege (BusCynara *cynara,
_dbus_assert(connection != NULL);
+ if (deferred_message_param)
+ deferred_message = *deferred_message_param;
+
if (dbus_connection_get_unix_user(connection, &uid) == FALSE)
return BUS_RESULT_FALSE;
@@ -189,14 +192,21 @@ bus_cynara_check_privilege (BusCynara *cynara,
break;
case CYNARA_API_CACHE_MISS:
- deferred_message = bus_deferred_message_new(message, sender, addressed_recipient,
- proposed_recipient, BUS_RESULT_LATER);
- if (deferred_message == NULL)
- {
- _dbus_verbose("Failed to allocate memory for deferred message\n");
- return_result = BUS_RESULT_FALSE;
- break;
- }
+ if (deferred_message == NULL)
+ {
+ deferred_message = bus_deferred_message_new(message, sender, addressed_recipient,
+ proposed_recipient, BUS_RESULT_LATER);
+ if (deferred_message == NULL)
+ {
+ _dbus_verbose("Failed to allocate memory for deferred message\n");
+ return_result = BUS_RESULT_FALSE;
+ break;
+ }
+ }
+ else
+ {
+ bus_deferred_message_ref(deferred_message);
+ }
/* callback is supposed to unref deferred_message*/
result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id,