+2003-08-11 Havoc Pennington <hp@pobox.com>
+
+ * bus/test.c (client_disconnect_handler): change to return
+ HANDLED (would have been REMOVE_MESSAGE)
+
+ * dbus/dbus-object.h (enum DBusHandlerResult): rename to
+ HANDLED/NOT_YET_HANDLED instead of
+ REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it
+ should be used.
+
2003-08-10 Havoc Pennington <hp@pobox.com>
* tools/dbus-send.c (main): add --type argument, for now
{
bus_dispatch (connection, message);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static void
{
if (!dbus_message_has_name (message,
DBUS_MESSAGE_LOCAL_DISCONNECT))
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
_dbus_verbose ("Removing client %p in disconnect handler\n",
connection);
client_loop = NULL;
}
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
static dbus_int32_t handler_slot = -1;
message = message_link->data;
- result = DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
reply_serial = dbus_message_get_reply_serial (message);
reply_handler_data = _dbus_hash_table_lookup_int (connection->pending_replies,
result = _dbus_message_handler_handle_message (handler, connection,
message);
- if (result != DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS)
+ if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
break;
link = next;
/* FIXME */ ;
/* Did a reply we were waiting on get filtered? */
- if (reply_handler_data && result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+ if (reply_handler_data && result == DBUS_HANDLER_RESULT_HANDLED)
{
/* Queue the timeout immediately! */
if (reply_handler_data->timeout_link)
}
}
- if (result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+ if (result == DBUS_HANDLER_RESULT_HANDLED)
goto out;
if (reply_handler_data)
message);
CONNECTION_LOCK (connection);
- if (result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+ if (result == DBUS_HANDLER_RESULT_HANDLED)
goto out;
if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
if (function != NULL)
return (* function) (handler, connection, message, user_data);
else
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
/** @} */
DBusMessage *message,
void *user_data)
{
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static void
#endif
_dbus_connection_unlock (registry->connection);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
_dbus_assert (iface_entry->n_objects > 0);
(* vtable->message) (&info, message);
- return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
typedef struct
#endif
_dbus_connection_unlock (registry->connection);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
_dbus_assert (signal_entry->n_connections > 0);
#endif
_dbus_connection_unlock (registry->connection);
- return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
/**
#endif
_dbus_connection_unlock (registry->connection);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
}
callback = dbus_callback_object_new (noop_message_function, NULL, NULL);
if (callback == NULL)
goto out;
-
+
+ interfaces = NULL;
switch (i % 3)
{
case 0:
interfaces = three_interfaces;
break;
}
+ _dbus_assert (interfaces != NULL);
if (!_dbus_object_registry_add_and_unlock (registry,
interfaces,
callback = dbus_callback_object_new (noop_message_function, NULL, NULL);
if (callback == NULL)
goto out;
-
+
+ interfaces = NULL;
switch (i % 4)
{
case 0:
interfaces = three_interfaces;
break;
}
+ _dbus_assert (interfaces != NULL);
if (!_dbus_object_registry_add_and_unlock (registry,
interfaces,
if (message != NULL)
{
if (_dbus_object_registry_handle_and_unlock (registry, message) !=
- DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+ DBUS_HANDLER_RESULT_HANDLED)
_dbus_assert_not_reached ("message not handled\n");
dbus_message_unref (message);
}
if (message != NULL)
{
if (_dbus_object_registry_handle_and_unlock (registry, message) !=
- DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+ DBUS_HANDLER_RESULT_HANDLED)
_dbus_assert_not_reached ("message not handled\n");
dbus_message_unref (message);
}
if (message != NULL)
{
if (_dbus_object_registry_handle_and_unlock (registry, message) !=
- DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS)
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
_dbus_assert_not_reached ("message handled but no handler was registered\n");
dbus_message_unref (message);
}
typedef enum
{
- DBUS_HANDLER_RESULT_REMOVE_MESSAGE, /**< Remove this message, no further processing. */
- DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS, /**< Run any additional handlers that are interested in this message. */
+ DBUS_HANDLER_RESULT_HANDLED, /**< Remove this message, no further processing. */
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Run any additional handlers that are interested in this message. */
DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory to handle this message. */
} DBusHandlerResult;
exit (0);
}
send_echo_message (connection);
+ return DBUS_HANDLER_RESULT_HANDLED;
}
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static void*
ECHO_MESSAGE))
{
send_echo_message (connection);
+ return DBUS_HANDLER_RESULT_HANDLED;
}
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static void
int i;
if (!dbus_message_has_name (message, "org.freedesktop.ThreadTest"))
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
dbus_message_iter_init (message, &iter);
g_string_free (counter_str, TRUE);
out:
- return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
static DBusHandlerResult
DBusMessage *message,
void *user_data)
{
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static DBusHandlerResult
void *user_data)
{
if (!dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT))
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
g_print ("connection disconnected\n");
dbus_connection_unref (connection);
- return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
static void
dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
reply = dbus_message_new_method_return (message);
dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static DBusHandlerResult
{
dbus_connection_disconnect (connection);
quit ();
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_HANDLED;
}
else
{
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
}
if (dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT))
exit (0);
- return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static void