From a89f5d1958eb48814b2c023e8bef01f3ab57bdef Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Mon, 14 Jul 2014 18:14:11 +0300 Subject: [PATCH] network: handle race condition of disappearing active connection Upstream commit 22611be7108fe8928198a06b818123fbf20b9aed --- network.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/network.py b/network.py index 9e893f7..c2d2135 100644 --- a/network.py +++ b/network.py @@ -171,6 +171,12 @@ def getActiveNetDevs(): for connection in active_connections: active_connection = bus.get_object(isys.NM_SERVICE, connection) active_connection_props_iface = dbus.Interface(active_connection, isys.DBUS_PROPS_IFACE) + try: + state = active_connection_props_iface.Get(isys.NM_ACTIVE_CONNECTION_IFACE, 'State') + except dbus.UnknownMethodGetError: + continue + if state != isys.NM_DEVICE_STATE_ACTIVATED: + continue devices = active_connection_props_iface.Get(isys.NM_ACTIVE_CONNECTION_IFACE, 'Devices') for device_path in devices: -- 2.0.1