Signals and bindings

Olivier Andrieu oliv__a at
Fri Sep 24 10:26:34 UTC 2004


I just committed a change that was discussed some time ago on the list
(in April):

It replaces the org.freedesktop.DBus.ServiceCreated and ServiceDeleted
signals by a single ServiceOwnerChanged signal that is also emitted
when a service gets a new owner (e.g. when a secondary owner becomes
primary owner). The idea being that this informs the bindings on which
base service owns what service so that dbus signals can be forwarded
to proxy objects.

Here's a summary of the current situation of the glib bindings as to
proxy objects. There are two functions for creating them:

 - dbus_g_proxy_new_for_service_owner proxies for the owner of the
requested service. It uses the org.freedesktop.GetServiceOwner method
to retrieve the base service and thus requires a round-trip to the
bus. Then it can send method calls and receive signals. 

 - dbus_g_proxy_new_for_service proxies for a service, taking into
account the fact that the owner can change over time. Sending method
calls is easy (just put the service in the destination field). However
receiving signals is more difficult because signals come with the base
service in the sender field. The proxy has first to get the base
service via GetServiceOwner and then it must "track" which base
service owns the service. (That's where the ServiceOwnerChanged signal
helps). Right now this tracking is not implemented, I'm working on it.

So, _new_for_service_owner needs a round-trip to be able to send
method calls and _new_for_service needs a round-trip to be able to
receive signals. For the latter, it could be possible to send the
GetServiceOwner request asynchronously and avoid the round-trip but
that means no signals would not be delivered until the reply arrives.

Any comments, ideas to improve this situation ?


More information about the dbus mailing list