how to get the DBusConnection for dbus_connection_dispatch from a DBusWatch of a DBusServer ?

Alexander Neundorf neundorf at eit.uni-kl.de
Thu Jun 18 03:06:14 PDT 2009


Hi,

in normal mode, i.e. with a DBus bus daemon, I have to call 
dbus_connection_dispatch(DBusConnection*) in reaction to an event on a file 
descriptor which I get from a DBusWatch via dbus_watch_get_unix_fd().
I get the watches via the watch callbacks, registered with 
dbus_connection_set_watch_functions().

Now I'm using plain libdbus and want to try to get it working in peer-to-peer 
mode.

Now, my issue is the following: 
without a dbus daemon, I'm the daemon myself, and I have set up watches using 
dbus_server_set_watch_functions(). This way I get my DBusWatch objects. These 
objects also have a file descriptor, and it happens that poll() on this file 
descriptor "fires".
What do I do then ?
I would expect to call dbus_connection_dispatch(), but I don't have a 
DBusConnection for this DBusWatch I got from the DBusServer. I also didn't 
find a way to get a DBusConnection from a DBusServer or something like 
dbus_server_dispatch(DBusServer*).

So, what should I do when my poll() reacts on a filedescriptor of a DBusWatch 
created from dbus_server_set_watch_functions() ?


Alex


More information about the dbus mailing list