From 1d1b0f20a467cf1cbdcaf81fbad3a111bcff6c48 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 12 Aug 2003 04:15:49 +0000 Subject: 2003-08-12 Havoc Pennington * bus/dispatch.c (bus_dispatch): make this return proper DBusHandlerResult to avoid DBUS_ERROR_UNKNOWN_METHOD * dbus/dbus-errors.c (dbus_set_error): use _dbus_string_append_printf_valist * dbus/dbus-string.c (_dbus_string_append_printf_valist) (_dbus_string_append_printf): new * dbus/dbus-errors.h (DBUS_ERROR_UNKNOWN_MESSAGE): change to UNKNOWN_METHOD * dbus/dbus-connection.c (dbus_connection_dispatch): handle DBUS_HANDLER_RESULT_NEED_MEMORY; send default error reply if a message is unhandled. --- bus/dispatch.c | 12 ++++++++---- bus/driver.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'bus') diff --git a/bus/dispatch.c b/bus/dispatch.c index 6902da65..e8f0c9ba 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -100,7 +100,7 @@ bus_dispatch_broadcast_message (BusTransaction *transaction, return TRUE; } -static void +static DBusHandlerResult bus_dispatch (DBusConnection *connection, DBusMessage *message) { @@ -108,6 +108,9 @@ bus_dispatch (DBusConnection *connection, DBusError error; BusTransaction *transaction; BusContext *context; + DBusHandlerResult result; + + result = DBUS_HANDLER_RESULT_HANDLED; transaction = NULL; dbus_error_init (&error); @@ -145,6 +148,7 @@ bus_dispatch (DBusConnection *connection, /* DBusConnection also handles some of these automatically, we leave * it to do so. */ + result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; goto out; } @@ -295,6 +299,8 @@ bus_dispatch (DBusConnection *connection, } dbus_connection_unref (connection); + + return result; } static DBusHandlerResult @@ -303,9 +309,7 @@ bus_dispatch_message_handler (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { - bus_dispatch (connection, message); - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + return bus_dispatch (connection, message); } static void diff --git a/bus/driver.c b/bus/driver.c index 6e0024b0..22e36e0a 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -662,7 +662,7 @@ bus_driver_handle_message (DBusConnection *connection, _dbus_verbose ("No driver handler for %s\n", name); - dbus_set_error (error, DBUS_ERROR_UNKNOWN_MESSAGE, + dbus_set_error (error, DBUS_ERROR_UNKNOWN_METHOD, "%s does not understand message %s", DBUS_SERVICE_DBUS, name); -- cgit