From 39dd1fcee640b4a5a9abb453a9ccd5b7e099ba1c Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 25 Jan 2003 20:53:53 +0000 Subject: 2003-01-25 Anders Carlsson * bus/Makefile.am: * bus/connection.c: (connection_disconnect_handler), (connection_watch_callback), (bus_connection_setup): * bus/dispatch.c: (send_one_message), (bus_dispatch_broadcast_message), (bus_dispatch_message_handler), (bus_dispatch_add_connection), (bus_dispatch_remove_connection): * bus/dispatch.h: * bus/driver.c: (bus_driver_send_service_deleted), (bus_driver_send_service_created), (bus_driver_handle_hello), (bus_driver_send_welcome_message), (bus_driver_handle_list_services), (bus_driver_remove_connection), (bus_driver_handle_message): * bus/driver.h: Refactor code, put the message dispatching in its own file. Use _DBUS_HANDLE_OOM. Also send ServiceDeleted messages when a client is disconnected. --- bus/connection.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bus/connection.c') diff --git a/bus/connection.c b/bus/connection.c index 0fcfdbe2..2b2a0432 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -21,7 +21,7 @@ * */ #include "connection.h" -#include "driver.h" +#include "dispatch.h" #include "loop.h" #include "services.h" #include @@ -54,8 +54,7 @@ connection_disconnect_handler (DBusConnection *connection, while ((service = _dbus_list_get_last (&d->services_owned))) bus_service_remove_owner (service, connection); - /* Tell bus driver that we want to get off */ - bus_driver_remove_connection (connection); + bus_dispatch_remove_connection (connection); /* no more watching */ dbus_connection_set_watch_functions (connection, @@ -78,9 +77,12 @@ connection_watch_callback (DBusWatch *watch, { DBusConnection *connection = data; + dbus_connection_ref (connection); + dbus_connection_handle_watch (connection, watch, condition); while (dbus_connection_dispatch_message (connection)); + dbus_connection_unref (connection); } static void @@ -159,7 +161,8 @@ bus_connection_setup (DBusConnection *connection) connection_disconnect_handler, NULL, NULL); - if (!bus_driver_add_connection (connection)) + /* Setup the connection with the dispatcher */ + if (!bus_dispatch_add_connection (connection)) return FALSE; return TRUE; -- cgit