mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-19 11:20:43 +02:00
bus_transaction_send: Take sender and destination connections
We'll need this if we want to stamp optional header fields on the message according to the preferences of the recipient(s). Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101899
This commit is contained in:
parent
02170d6fa6
commit
c6b91129fa
3 changed files with 18 additions and 17 deletions
|
|
@ -2311,7 +2311,7 @@ bus_transaction_capture (BusTransaction *transaction,
|
|||
{
|
||||
DBusConnection *recipient = link->data;
|
||||
|
||||
if (!bus_transaction_send (transaction, recipient, message))
|
||||
if (!bus_transaction_send (transaction, sender, recipient, message))
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -2420,12 +2420,13 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return bus_transaction_send (transaction, connection, message);
|
||||
return bus_transaction_send (transaction, NULL, connection, message);
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
bus_transaction_send (BusTransaction *transaction,
|
||||
DBusConnection *connection,
|
||||
DBusConnection *sender,
|
||||
DBusConnection *destination,
|
||||
DBusMessage *message)
|
||||
{
|
||||
MessageToSend *to_send;
|
||||
|
|
@ -2442,15 +2443,15 @@ bus_transaction_send (BusTransaction *transaction,
|
|||
dbus_message_get_member (message) : "(unset)",
|
||||
dbus_message_get_error_name (message) ?
|
||||
dbus_message_get_error_name (message) : "(unset)",
|
||||
dbus_connection_get_is_connected (connection) ?
|
||||
dbus_connection_get_is_connected (destination) ?
|
||||
"" : " (disconnected)");
|
||||
|
||||
_dbus_assert (dbus_message_get_sender (message) != NULL);
|
||||
|
||||
if (!dbus_connection_get_is_connected (connection))
|
||||
return TRUE; /* silently ignore disconnected connections */
|
||||
if (!dbus_connection_get_is_connected (destination))
|
||||
return TRUE; /* silently ignore disconnected destinations */
|
||||
|
||||
d = BUS_CONNECTION_DATA (connection);
|
||||
d = BUS_CONNECTION_DATA (destination);
|
||||
_dbus_assert (d != NULL);
|
||||
|
||||
to_send = dbus_new (MessageToSend, 1);
|
||||
|
|
@ -2459,7 +2460,7 @@ bus_transaction_send (BusTransaction *transaction,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
to_send->preallocated = dbus_connection_preallocate_send (connection);
|
||||
to_send->preallocated = dbus_connection_preallocate_send (destination);
|
||||
if (to_send->preallocated == NULL)
|
||||
{
|
||||
dbus_free (to_send);
|
||||
|
|
@ -2474,13 +2475,13 @@ bus_transaction_send (BusTransaction *transaction,
|
|||
|
||||
if (!_dbus_list_prepend (&d->transaction_messages, to_send))
|
||||
{
|
||||
message_to_send_free (connection, to_send);
|
||||
message_to_send_free (destination, to_send);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_dbus_verbose ("prepended message\n");
|
||||
|
||||
/* See if we already had this connection in the list
|
||||
/* See if we already had this destination in the list
|
||||
* for this transaction. If we have a pending message,
|
||||
* then we should already be in transaction->connections
|
||||
*/
|
||||
|
|
@ -2500,10 +2501,10 @@ bus_transaction_send (BusTransaction *transaction,
|
|||
|
||||
if (link == NULL)
|
||||
{
|
||||
if (!_dbus_list_prepend (&transaction->connections, connection))
|
||||
if (!_dbus_list_prepend (&transaction->connections, destination))
|
||||
{
|
||||
_dbus_list_remove (&d->transaction_messages, to_send);
|
||||
message_to_send_free (connection, to_send);
|
||||
message_to_send_free (destination, to_send);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@ typedef void (* BusTransactionCancelFunction) (void *data);
|
|||
BusTransaction* bus_transaction_new (BusContext *context);
|
||||
BusContext* bus_transaction_get_context (BusTransaction *transaction);
|
||||
dbus_bool_t bus_transaction_send (BusTransaction *transaction,
|
||||
DBusConnection *connection,
|
||||
DBusConnection *sender,
|
||||
DBusConnection *destination,
|
||||
DBusMessage *message);
|
||||
dbus_bool_t bus_transaction_capture (BusTransaction *transaction,
|
||||
DBusConnection *connection,
|
||||
|
|
|
|||
|
|
@ -108,9 +108,7 @@ send_one_message (DBusConnection *connection,
|
|||
return TRUE; /* don't send it but don't return an error either */
|
||||
}
|
||||
|
||||
if (!bus_transaction_send (transaction,
|
||||
connection,
|
||||
message))
|
||||
if (!bus_transaction_send (transaction, sender, connection, message))
|
||||
{
|
||||
BUS_SET_OOM (error);
|
||||
return FALSE;
|
||||
|
|
@ -165,7 +163,8 @@ bus_dispatch_matches (BusTransaction *transaction,
|
|||
}
|
||||
|
||||
/* Dispatch the message */
|
||||
if (!bus_transaction_send (transaction, addressed_recipient, message))
|
||||
if (!bus_transaction_send (transaction, sender, addressed_recipient,
|
||||
message))
|
||||
{
|
||||
BUS_SET_OOM (error);
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue