Tracking whether a connection is alive

Daniel Silverstone dsilvers at digital-scurf.org
Sun Jul 11 15:26:54 PDT 2004


David Zeuthen wrote:
> Is there any easier or more general way to do this? Can the problem be
> solved in a general way that may be useful for other applications of D-
> BUS?

When you process the AcquireLock() method... obtain the base service of the 
caller using dbus_message_get_sender().

Add a matcher to your connection similar to:

   dbus_bus_add_match( connection, 
"interface='org.freedesktop.DBus',member='ServiceDeleted'", NULL );

Then, in your filter function...

   if( dbus_message_is_signal( message,
                               "org.freedesktop.DBus",
                               "ServiceDeleted" ) ) {
    /* code to forcibly release the lock*/
}

I hope that helps.

D.

-- 
Daniel Silverstone                         http://www.digital-scurf.org/
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895



More information about the dbus mailing list