dbus daemon - creating a logfile of all messages
Havoc Pennington
hp at redhat.com
Thu May 11 08:25:57 PDT 2006
Ralf Habacker wrote:
>
> void _dbus_loop_run(DBusLoop * loop)
> {
> DBusMessage* msg;
> DBusConnection *conn = _dbus_list_pop_first (&loop->need_dispatch);
>
> _dbus_verbose (" %d connections to dispatch\n", _dbus_list_get_length (&loop->need_dispatch));
> _dbus_loop_ref (loop);
>
>
> // loop listening for signals being emmitted
> while (1) {
>
> // non blocking read of the next available message
> dbus_connection_read_write(conn, 0);
> while(dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS)
> ;
> sleep(1);
> }
This does not make any sense. I think for what you're doing there's no
reason to use DBusLoop; it's just confusing matters.
Looking at the old dbus-monitor.c, to fix it just remove the GMainLoop
and replace g_main_loop_run with:
while (dbus_connection_read_write_dispatch(connection, -1)
;
I think that will work with no further effort.
Havoc
More information about the dbus
mailing list