From 472e49e7b3065c13ec3a6d9c87ca3c37511df2af Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 2 Mar 2023 18:23:22 +0100 Subject: [PATCH] test/nm-service: make activation delay actually useful The activation_state_change_delay_ms was not too useful, since it could be changed only after the AC started activating. Not a big deal, since it was actually unused. Apart from that, the SetActiveConnectionStateChangedDelay() didn't make a whole lot of sense either: it accepted a Device path, but actually was looking up an AC. Let's move the property to the Device, so that 1.) it can be adjusted before the AC is constructed (the AC will inherit it from the Device) and 2.) SetActiveConnectionStateChangedDelay() does no longer hurt my feelings. --- tools/test-networkmanager-service.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index 04c6c5213f..dab89e1db9 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -830,6 +830,7 @@ class Device(ExportedObj): self.ip6_config = None self.dhcp4_config = None self.dhcp6_config = None + self.activation_state_change_delay_ms = 50 self.prp_state = NM.DeviceState.UNAVAILABLE @@ -1407,9 +1408,9 @@ class ActiveConnection(ExportedObj): self.con_inst = con_inst self.is_vpn = con_inst.is_vpn() + self.activation_state_change_delay_ms = device.activation_state_change_delay_ms self._activation_id = None self._deactivation_id = None - self.activation_state_change_delay_ms = 50 s_con = con_inst.con_hash[NM.SETTING_CONNECTION_SETTING_NAME] @@ -1937,9 +1938,9 @@ class NetworkManager(ExportedObj): @dbus.service.method(dbus_interface=IFACE_TEST, in_signature="ou", out_signature="") def SetActiveConnectionStateChangedDelay(self, devpath, delay_ms): - for ac in reversed(self.active_connections): - if ac.device.path == devpath: - ac.activation_state_change_delay_ms = delay_ms + for d in self.devices: + if d.path == devpath: + d.activation_state_change_delay_ms = delay_ms return raise BusErr.UnknownDeviceException( "Device with iface '%s' not found" % devpath