Talking to NM 0.7 with dbus vs. libnm_glib
- From: Christian Huff <christian huff silur de>
- To: networkmanager-list gnome org
- Subject: Talking to NM 0.7 with dbus vs. libnm_glib
- Date: Wed, 06 May 2009 22:42:43 +0200
Hi,
I am currently working at the libpurple/pidgin NetworkManager
integration code to improve to user experience with roaming with
multiple devices. Currently, libpurple only reacts to the global
StateChange signal, which does not change if one device goes offline or
online and there is another active device. In effect, this often results
in the inability to send or receive messages - the apps stalls until a
timeout occurs.
libpurple gets the current global NM state through Dbus, so, being kinda
new to glib programming, I tried to get NM's devices, connect to device
StateChanged, DeviceAdded and DeviceRemoved signals using
dbus_g_proxy_connect_signal. Doing so, I found I needed to register
custom marshallers as NetworkManager.h didn't provide them (this was
with 0.7.0, I haven't checked 0.7.1 yet). Also, I had to store a proxy
for each device, effectively producing some overly complicated code that
wouldn't make it into libpurple...
So I read that libnm_glib was rewritten with 0.7, and rewrote my patch
using it. The code turned out much cleaner, yet I found some problems
that I want to share with you. One of the goals I had set myself was to
minimize the number of unnecessary reconnects. A scheme to do so would
be to track the devices that are active at a connect action, and
reconnect only if such a "critical" device goes down. Another would be
to see if the device currently going down is part of an Active
Connection (NMActiveConnection) that NM reports as being the/a default
connection for DNS and routes.
While the former scheme was not perfect, the latter wasn't reliable,
either. I found nm_active_connection_get_default() to often return true
for multiple active connections, and sometimes the value from before and
sometimes the predicted value from after the device StateChanged event.
That kind of synchronisation problems currently prevent me from
implementing that scheme.
Also, I tried to entirely replace the dbus functionality, but
libnm_glib_get_network_state() does not return values equivalent to the
StateChanged signal, and I didn't find the signal in the libnm_glib docs.
The current version of my patch reconnects any time a device enters or
leaves the NM_DEVICE_STATE_ACTIVATED state, and can be found at:
http://developer.pidgin.im/ticket/8694
thanks for your feedback,
Christian Huff (Pedric)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]