Re: How to get notification of NetworkManager restart



On Mon, 2012-01-30 at 16:56 -0800, Greg Suarez wrote:
> Hi all,
> 
> My code communicates with NM via dbus c-api and I would like know how
> to detect when NM restarts so I can tear down the old connection and
> create a new one.
> What I'm seeing right now is when NM restarts I cease to get any
> notifications from NM.  I'm working with NM 0.9

If you listen to the "NameOwnerChanged" signals from the core dbus
daemon you'll get notifications of service restarts.  NM even does this
in places to see when stuff like wpa_supplicant quits.  This signal has
3 parameters: the dbus service name that had an owner change, the old
owner name, and the new owner name.  So when NM starts you'd get
something like this:

"org.freedesktop.NetworkManager","",":1.36"

and when NM quits, you'd get something like this:

"org.freedesktop.NetworkManager",":1.36",""

which you can use to figure out when to tear down the old connection and
to make a new one.

Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]