summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2021-05-07 11:13:26 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2021-05-17 07:57:53 +0200
commit54a0f22c7ddaaa86deb2bde6734fb2448300914c (patch)
tree9f6f1accbc1f83fd492d5ae0c4bd551229e557a6
parent3f4d8751bd55394a10425866a69199295ddd6d07 (diff)
downloaddbus-54a0f22c7ddaaa86deb2bde6734fb2448300914c.tar.gz
dbus-54a0f22c7ddaaa86deb2bde6734fb2448300914c.tar.bz2
dbus-54a0f22c7ddaaa86deb2bde6734fb2448300914c.zip
dbus-daemon: send signals on connection overflowsubmit/tizen/20210524.120505accepted/tizen/unified/20210531.130419
Change-Id: I4f0e78fe9ad8c63da7256f2dadae2029eb534004
-rw-r--r--bus/connection.c8
-rw-r--r--bus/connection.h1
-rw-r--r--bus/dispatch.c43
3 files changed, 50 insertions, 2 deletions
diff --git a/bus/connection.c b/bus/connection.c
index 78948c6c..15aea6ed 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -2728,6 +2728,14 @@ bus_transaction_execute_and_free (BusTransaction *transaction)
transaction_free (transaction);
}
+DBusList *
+bus_transaction_copy_connections (BusTransaction *transaction)
+{
+ DBusList *result = NULL;
+ _dbus_list_copy (&transaction->connections, &result);
+ return result;
+}
+
static void
bus_connection_remove_transactions (DBusConnection *connection)
{
diff --git a/bus/connection.h b/bus/connection.h
index acaee151..6da99a35 100644
--- a/bus/connection.h
+++ b/bus/connection.h
@@ -173,6 +173,7 @@ dbus_bool_t bus_transaction_send_error_reply (BusTransaction *
DBusMessage *in_reply_to);
void bus_transaction_cancel_and_free (BusTransaction *transaction);
void bus_transaction_execute_and_free (BusTransaction *transaction);
+DBusList * bus_transaction_copy_connections (BusTransaction *transaction);
dbus_bool_t bus_transaction_add_cancel_hook (BusTransaction *transaction,
BusTransactionCancelFunction cancel_function,
void *data,
diff --git a/bus/dispatch.c b/bus/dispatch.c
index d829296c..50bb78bf 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -314,11 +314,17 @@ bus_dispatch_matches (BusTransaction *transaction,
dest = link->data;
+ link = _dbus_list_get_next_link (&recipients, link);
+
+ if (_dbus_connection_is_overflowed (dest)
+ && dbus_message_is_signal (message,
+ DBUS_INTERFACE_TIZEN,
+ DBUS_TIZEN_CONNECTION_OVERFLOW_SIGNAL))
+ continue;
+
if (!send_one_message (dest, context, sender, addressed_recipient,
message, transaction, &tmp_error))
break;
-
- link = _dbus_list_get_next_link (&recipients, link);
}
_dbus_list_clear (&recipients);
@@ -332,6 +338,35 @@ bus_dispatch_matches (BusTransaction *transaction,
return BUS_RESULT_TRUE;
}
+static void
+bus_check_connection_overflow (BusContext *context,
+ DBusList *connections)
+{
+ BusTransaction *transaction;
+ DBusConnection *recipient;
+ DBusError error;
+
+ transaction = bus_transaction_new (context);
+ if (transaction == NULL)
+ return;
+
+ dbus_error_init (&error);
+
+ while ((recipient = _dbus_list_pop_first (&connections)))
+ if (_dbus_connection_is_overflowed (recipient))
+ {
+ if (!bus_driver_send_connection_overflow (recipient, transaction, &error))
+ {
+ bus_transaction_cancel_and_free (transaction);
+ transaction = NULL;
+ break;
+ }
+ }
+
+ if (transaction != NULL)
+ bus_transaction_execute_and_free (transaction);
+}
+
static DBusHandlerResult
bus_dispatch (DBusConnection *connection,
DBusMessage *message)
@@ -700,7 +735,11 @@ bus_dispatch (DBusConnection *connection,
if (transaction != NULL)
{
+ DBusList *connections_copy = bus_transaction_copy_connections (transaction);
+
bus_transaction_execute_and_free (transaction);
+
+ bus_check_connection_overflow (context, connections_copy);
}
dbus_connection_unref (connection);