summaryrefslogtreecommitdiffstats
path: root/bus/connection.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@codefactory.se>2003-01-25 20:53:53 +0000
committerAnders Carlsson <andersca@codefactory.se>2003-01-25 20:53:53 +0000
commit39dd1fcee640b4a5a9abb453a9ccd5b7e099ba1c (patch)
tree152435396d67fa175d8a27ccb827f1bdb54917ba /bus/connection.c
parentfdddf7246da9ea6ce841146e2befe843aede0466 (diff)
2003-01-25 Anders Carlsson <andersca@codefactory.se>
* 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.
Diffstat (limited to 'bus/connection.c')
-rw-r--r--bus/connection.c11
1 files changed, 7 insertions, 4 deletions
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 <dbus/dbus-list.h>
@@ -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;