disappearing messages with dbus_connection_read_write_dispatch & dbus_connection_pop_message
hp at redhat.com
Tue Oct 16 09:19:17 PDT 2007
Tim Wuyts wrote:
> - // non blocking read of the next available message
> - dbus_connection_read_write(conn, 0);
> + // blocking read of the next available message
> + dbus_connection_read_write_dispatch(conn, -1);
> msg = dbus_connection_pop_message(conn);
You changed two things here: you made it blocking (the -1) and you made
it dispatch messages. If you dispatch a message, it won't be available
to pop. So, you "lose" the message.
If you install a handler for the message, e.g. with
dbus_connection_register_fallback() or register_object_path(), then that
handler would receive the message when you dispatch. But if you have no
handlers, dispatching just drops the message.
In short, you need to choose between dispatching to handlers, or
bypassing all that and just popping messages off to handle them
yourself. Doing both doesn't make sense.
More information about the dbus