g_network_monitor_nm never updates on connection change (listens for signal on wrong dbus interface)
g_network_monitor_nm tries to listen for a PropertiesChanged
event, but it is connected to the org.freedesktop.NetworkManager
interface, while the PropertiesChanged
signal is emitted on org.freedesktop.DBus.Properties
.
Hence what happens as can be seen by attaching gdb to a running packagekitd, when you change connectivity in NM, proxy_signal_cb()
gets called for the org.freedesktop.NetworkManager
signals DeviceAdded
, DeviceRemoved
, DeviceChanged
; but never for the actual PropertiesChanged
event it compares against, so it exits early after
if (g_strcmp0 (signal_name, "PropertiesChanged") != 0)
return;
This means we never call sync_properties (add a break point on it and confirm :D), and hence our online status will always be the same as when we initialized the network monitor.
We saw this as part of https://bugs.launchpad.net/ubuntu/+source/packagekit/+bug/1946196
I think the fix is to add another proxy, for the org.freedesktop.DBus.Properties
interface, and connect the signal_proxy_cb
to it instead.