Emitting signals
Ross Burton
ross at burtonini.com
Wed Jul 27 22:11:40 EST 2005
On Wed, 2005-07-27 at 13:05 +0200, Lennart Poettering wrote:
> I am currently working on implementing a DBUS interface for the Avahi
> mDNS stack (http://www.freedesktop.org/Software/Avahi). I have a few
> questions on using DBUS:
Sweet. Avahi rocks my world.
> Using Avahi DBUS clients may register mDNS services. These services
> need to be automatically removed when the client which created them
> terminates. If I understood correctly I can implement this by
> listening to "NameOwnerChanged" signals, correct?
Yes, you'll get a signal and the current name member will be an empty
string.
> The state of these mDNS services may change during
> lifetime. (i.e. REGISTERING -> CONFLICT, REGISTERING -> ESTABLISHED,
> or similar) The client which registered them needs to be notified
> about this. These notifactions need not to be handled and can happen
> asynchronously. Therefore I thougt that DBUS signals are the way to go
> for this. However, as it seems DBUS signals are usually broadcast to
> all clients connected to the bus (at least dbus_message_new_signal()
> doesn't have a "destination" parameter), which is something which
> doesn't make sense in my situation since only one client should
> recieve the notifcation. So I guess my design is flawed. Or isn't it?
> Can I use dbus_message_set_destination() to specifiy the destination?
Yes, signals are broadcast to all clients. I'd suggest either sending
the signals and make the client filter the signals itself. My app
solves this by sending normal messages to the client, but I can do this
as I've got a client library which handles the incoming messages and
transforms them into GObject signals for the applications.
Ross
--
Ross Burton mail: ross at burtonini.com
jabber: ross at burtonini.com
www: http://www.burtonini.com./
PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF
More information about the dbus
mailing list