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 07:25:04 PDT 2009


On Thursday 18 June 2009 15:22:38 Thiago Macieira wrote:
> Alexander Neundorf wrote:
> >> This is true of the connection watches and timeouts also really; you
> >> don't dispatch when the watch is ready, you dispatch when dispatch
> >> status changes. (set_dispatch_status_function or whatever)
> >
> >I don't understand what you mean.
> >Is it correct to call poll() on all the file descriptors ?
> >What should I do then ?
> >If I don't call dbus_connection_dispatch(), who will call this status
> >callback ?
> >Can you please elaborate a bit ?
>
> When handling a DBusWatch, you just call dbus_watch_handle(). You
> shouldn't call the dispatch function just because you received activity on
> the socket.

Ok.
When a client tries to connect, I get two AddWatch() callbacks.
That's ok, but I didn't find any documentation what they are good for (I would 
have expected one instead of two). I wait for the enabled ones using poll().
One is enabled, the other one isn't.
Then I get ToggleWatch() callbacks.
This seems to toggle the enabled/disabled state of the two watches.
Does the enabled/disabled state have any other purpose than to tell me whether 
I should poll on this file descriptor ?
I mean, does it also do something internally ?

So, I have now these two watches, one is on, one is off, but I don't get 
another event, although the client tries to send a message.
I also don't get the DispatchStateChanged() callback.
(I call dbus_connection_set_dispatch_status_function() in my 
newConnectionCallback with the new DBusConnection* as first argument. 

Any hints ?

Alex, who thinks a book on DBus would be a good idea...


More information about the dbus mailing list