hal_initialize() overrides other filter/object/fallback functions on separate connection

David Zeuthen david at fubar.dk
Sat Aug 7 11:51:41 PDT 2004


On Tue, 2004-08-03 at 02:00 +0200, David Zeuthen wrote:
> On Tue, 2004-08-03 at 01:00 +0200, Olivier Andrieu wrote:
> >  > > Seems to be a dbus problem?
> >  > >
> >  > 
> >  > I think this is an issue with D-BUS, yes, why would the filter
> >  > function in the DBusConnection from libhal receive messages bound
> >  > for the DBusConnection made in your main application?
> > 
> > Well, when you call dbus_bus_get(DBUS_BUS_SYSTEM) several times, it
> > opens the connection the first time but then it just _ref() it. 
> 
> Hey, guess I just should have read the documentation :-). 
> 
> However, I'm not convinced, though, that this behavior is always desired
> considering that the DBusConnection's got state; e.g. you subscribe to
> signals on a per-connection basis. 
> 
> So, in particular, this is bad if you have several (distant) parts of
> the same process communicating with the same D-BUS service in the other
> end. With distant I mean that the different parts of the process are not
> necessarily aware of each other (think processes that dlopen() stuff)
> and that the process per se isn't written to use D-BUS. 
> 
> So it would be nice to have a dbus_bus_get_no_recycle() function,
> however, I'm sure the name of the function can be improved.
> 

Hey, 

I found a better name, now it's dbus_bus_get_dedicated(), and I wrote a
patch do this. I've tested it against Dan's testcase [1]. Let me know if
I should create a testcase for this in D-BUS code, and if yes, please
give a pointer to where and how.

Patch is against CVS (the anon pserver interface still works). Ok to
commit? (once CVS access is back, that is).

Cheers,
David

[1] : this requires a modification to the libhal CVS, since the 'bug'
was in libhal. To reproduce the failing of the testcase simply replace
DBUS_HANDLER_RESULT_NOT_YET_HANDLED with DBUS_HANDLER_RESULT_HANDLED in
the last line of libhal.c:filter_function(). To verify that this D-BUS
patch works replace dbus_bus_get() with dbus_bus_get_dedicated in
libhal.c:hal_initialize(). The testcase should no longer fail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-bus-get-dedicated.patch
Type: text/x-patch
Size: 6652 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040807/4d8c5c62/dbus-bus-get-dedicated.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list