Basic understanding servers / clients objects/proxies

Thiago Macieira thiago at kde.org
Wed Dec 12 11:37:37 PST 2007


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
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20071212/0d6194de/attachment.pgp 


More information about the dbus mailing list