Multiple connections to the same bus from the same client

Kay Sievers kay.sievers at
Tue Sep 28 10:57:49 UTC 2004

On Tue, 2004-09-28 at 03:37 -0500, Jon Trowbridge wrote:
> On Mon, 2004-09-27 at 23:28 +0100, Bastien Nocera wrote:
> > On Tue, 2004-09-28 at 03:46 -0500, Jon Trowbridge wrote:
> > > Is there any scenario in which it would make sense for a single instance
> > > of a application to open multiple simultaneous connections to a bus?
> > 
> > Make sense, I don't know, but a GNOME application that uses d-bus for
> > its IPC, has a BaconCdSelection widget (a simple CD device selection
> > widget that uses HAL) and uses the GnomeVFSVolume API (which uses HAL as
> > well) would have 2 connection to the d-bus via HAL and one direct one
> > (possibly not to the system bus though).
> This was exactly the sort of case I was worried about when I originally
> posted --- apps ending up with lots of connections to one message bus
> because of libraries.
> Fortunately, someone else already had that worry.  I just looked at the
> source code, and dbus_bus_get does the right thing: it will return the
> previously-opened connection if you try to connect to the same bus
> multiple times.

Yeah, but be prepared for that "fortune" :). If you have multiple parts
of a process talking through the same socket you get all signals for
both subscriptions, you can't expect to get only the ones you subscribed

And remember not to return DBUS_HANDLER_RESULT_HANDLED cause this will
prevent the delivery to the other part of your process (you may not even
know about that).

There was a long thread about this and I'm still not happy with the
current behavior:


More information about the dbus mailing list