hp at redhat.com
Sat Aug 18 09:25:38 PDT 2007
On 8/18/07, Fan Wu <wufan9418 at gmail.com> wrote:
> Sorry I didn't make myself clear when referring to "error message".
> What I meant was DBusError which I think include both the error
> DBusMessages and the errors set by the libdbus (reply timeout, or bad
> DBusMessage etc), and pass the DBusError to the callbacks.
For requesting a name, a DBusError is effectively impossible unless
there's a bug in the bus, or the connection disconnects.
For disconnect I think calling the "not owned" callback and then
calling a disconnect callback is appropriate; this should not be
treated as an error but just as a disconnect.
For a bug in the bus, I would say just printing a warning in the
library itself is fine (probably with some way for apps to override
the warning handler).
typedef void (* GBusUnexpectedErrorHandler) (const DBusError *error,
const char *context_description, void *data);
default_unexpected_error_handler(const DBusError *error, const char
*context_description, void *data)
_dbus_warn("%s: did not expect error %s: %s\n", context_description,
So then when doing the request name (note that dbus_bus_request_name
blocks so should not be used, we'd do it async):
old_state = OWNED, NOT_OWNED, or UNKNOWN;
// an error is expected if we were disconnected, so don't warn
a bus name");
new_state = NOT_OWNED;
new_state = OWNED or NOT_OWNED depending on reply;
if (new_state == OWNED && new_state != old_state)
else if (new_state == NOT_OWNED && new_state != old_state)
Something like that...
More information about the dbus