Monitoring lifetimes with Python bindings

John (J5) Palmieri johnp at redhat.com
Thu Jul 7 06:45:26 EST 2005


On Wed, 2005-07-06 at 16:42 +0200, Ole Laursen wrote:
> Hi,
> 
> (I'm resending this since the previous message seems to have been
> lost.)
> 
> In the use case I'm trying to design, a per-session server will
> display a bit of UI for various clients. I'm trying to figure out how
> to ensure that both the server and the clients are fault-tolerant. If
> the server fails, the clients should detect the error and probably try
> to resend its UI info if a new server appears. If a client fails, the
> server should remove the UI belonging to the client.
> 
> This requires that the server can monitor the lifetime of a connecting
> client. It is not immediately obvious how to do this with D-BUS, but I
> think I need to make the server notice the sender upon receiving a
> request from a client and then let it subscribe to NameOwnerChanged
> signals to discover if the client name has changed from ":1.blahblah"
> to "" (hm, but this leads to a race condition).
> 
> 
> Anyway, this does not appear to be possible with the Python bindings
> since there is no way to get to the message and thus the sender when
> receiving a remote call. @dbus.explicitly_pass_message in 0.34 only
> seems to work with signals.

@dbus.explicitly_pass_message is mainly for debugging.  Messages should
not be exposed in the python bindings.  The best thing to do is for your
client to send its unique name to the server when it connects to the bus
and register the NameOwnerChanged signal with sender equal to the name
you received.  You can also use the GetNameOwner call to get the unique
name of an already running process.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list