From 6ecc14ffabcffb69aa938a67940db48272e05046 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 13 Mar 2003 03:52:58 +0000 Subject: 2003-03-12 Havoc Pennington Throughout: purge global variables, introduce BusActivation, BusConnections, BusRegistry, etc. objects instead. * bus/bus.h, bus/bus.c: introduce BusContext as a global message bus object * test/Makefile.am (TEST_BINARIES): disable bus-test for now, going to redo this a bit differently I think --- bus/dispatch.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'bus/dispatch.c') diff --git a/bus/dispatch.c b/bus/dispatch.c index d9fe81ac..1d2ea1c2 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -24,7 +24,9 @@ #include "dispatch.h" #include "connection.h" #include "driver.h" +#include "services.h" #include "utils.h" +#include "bus.h" #include #include @@ -63,14 +65,18 @@ bus_dispatch_broadcast_message (BusTransaction *transaction, { DBusError tmp_error; SendMessageData d; + BusConnections *connections; _dbus_assert (dbus_message_get_sender (message) != NULL); + connections = bus_transaction_get_connections (transaction); + dbus_error_init (&tmp_error); d.message = message; d.transaction = transaction; d.error = &tmp_error; - bus_connection_foreach (send_one_message, &d); + + bus_connections_foreach (connections, send_one_message, &d); if (dbus_error_is_set (&tmp_error)) { @@ -145,9 +151,13 @@ bus_dispatch_message_handler (DBusMessageHandler *handler, const char *sender, *service_name, *message_name; DBusError error; BusTransaction *transaction; - + BusContext *context; + transaction = NULL; dbus_error_init (&error); + + context = bus_connection_get_context (connection); + _dbus_assert (context != NULL); /* If we can't even allocate an OOM error, we just go to sleep * until we can. @@ -181,7 +191,7 @@ bus_dispatch_message_handler (DBusMessageHandler *handler, _dbus_assert (service_name != NULL); /* this message is intended for bus routing */ /* Create our transaction */ - transaction = bus_transaction_new (); + transaction = bus_transaction_new (context); if (transaction == NULL) { BUS_SET_OOM (&error); @@ -224,9 +234,12 @@ bus_dispatch_message_handler (DBusMessageHandler *handler, { DBusString service_string; BusService *service; + BusRegistry *registry; + registry = bus_connection_get_registry (connection); + _dbus_string_init_const (&service_string, service_name); - service = bus_service_lookup (&service_string); + service = bus_registry_lookup (registry, &service_string); if (service == NULL) { -- cgit