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.
This commit is contained in:
Lubomir Rintel 2023-03-02 18:23:22 +01:00
parent 5ae3dc03a5
commit 472e49e7b3

View file

@ -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