Basic understanding servers / clients objects/proxies
thebelserturner at gmail.com
Wed Dec 12 11:51:12 PST 2007
On Dec 12, 2007 2:37 PM, Thiago Macieira <thiago at kde.org> wrote:
> David Belser wrote:
> >Method calls on my exported objects will pass through my filter routine
> >(which should ignore them) and then get passed to my object handler (
> >_vtable handler function ) for my object to handle. Signals that I have
> >added match rules will also pass to my filter function which will then
> > act upon them.
> >What I'm trying to understand is the correct way to handle inbound
> > (async?) messages in an application that both exports objects and uses
> > remote objects.
> You seemed to describe the procedure perfectly in the previous paragraph.
> What part of it didn't you understand?
> Incoming calls should be delivered to you via the vtable, like you said
> above. For incoming replies:
> >The third type of inbound messages would be replies to calls on remote
> >objects, is it correct to also handle these in my filter function, or
> >additional filter functions on a per-proxy object? I presume that I
> > don't need to add a match rule to receive the replies to remote calls
> > as they should be addressed to me as the destination.
> Normally, you'll be using DBusPendingCall for incoming replies (methed
> returns and errors). Which means the library will remove those messages
> from the queue before the message filters are run. The message filters
> will not see most replies then.
> You only need to look for message replies if you sent a method-call
> message using dbus_connection_send and did not create a DBusPendingCall
> for it. dbus_connection_send_with_reply automatically creates one for
> you, and dbus_connection_send_with_reply_and_block returns the
> DBusMessage that is the reply already, without running filters.
> Even so, you may still receive spurious method reply messages in your
> filters. You should ignore them unless you have a good reason not to.
> Sometimes, there may be a duplicate reply (if the callee replied after
> you expired your DBusPendingCall). Or they can be caused by someone
> sending arbitrary junk messages on the bus.
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Thanks Thiago, I hoped I had it mostly right just looking for
confirmation and more about handling replies.
More information about the dbus