bus_name_has_owner in python

Tony Houghton h at realh.co.uk
Mon Mar 19 17:33:32 PDT 2007


In <1174346677.3647.6.camel at localhost.localdomain>, John (J5) Palmieri wrote:

> On Sat, 2007-03-17 at 12:49 -0400, Havoc Pennington wrote:
> 
> >   2) if you did want to use bus_name_has_owner() (which you don't) you 
> > would just create a proxy object for the org.freedesktop.DBus bus name 
> > and interface, and call methods on that proxy
> 
> And in fact we should deprecate all convenience functions that can be
> called from the bus.  Python makes it dead easy to make these calls so
> we should encourage people to use D-Bus API's directly instead of
> wrappers.

I think I've spotted a problem with the current python API. In a
scenario similar to the one I've written, a program might try to request
a name with BusName. If the program does indeed become the name owner it
would create a service.Object then hang around waiting for other
instances to use the service. But if another process already has the
name, the new process would send a message to it to make it do whatever
the user wanted then exit. Currently this only works properly if you use
the DO_NOT_QUEUE flag; otherwise the program can't tell whether it
really has the name at the moment or is queued, so the new instance
would stay running when really it should exit. Or would it get an error
if it tried to create an object with the same path as one that already
exists?

-- 
TH * http://www.realh.co.uk


More information about the dbus mailing list