mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 01:19:23 +01:00
auto-t: only call set_value for changed values in default()
The default() method was added for convenience but was extending the test times significantly when the hostapd config was lengthy. This was because it called set_value for every value regardless if it had changed. Instead store the current configuration and in default() only reset values that differ.
This commit is contained in:
parent
65a03d8049
commit
d756e60f24
@ -75,6 +75,8 @@ class HostapdCLI(object):
|
||||
if self._default_config.get('vendor_elements', None) == None:
|
||||
self._default_config['vendor_elements'] = ''
|
||||
|
||||
self._current_config = self._default_config.copy()
|
||||
|
||||
if not self.interface:
|
||||
raise Exception('config %s not found' % config)
|
||||
|
||||
@ -170,6 +172,8 @@ class HostapdCLI(object):
|
||||
if self._default_config.get(key, None) == None:
|
||||
raise Exception("Untracked setting '%s'! Please set default in hostapd config" % key)
|
||||
|
||||
self._current_config[key] = value
|
||||
|
||||
cmd = self.cmdline + ['set', key, value]
|
||||
ctx.start_process(cmd).wait()
|
||||
|
||||
@ -200,7 +204,10 @@ class HostapdCLI(object):
|
||||
|
||||
def default(self):
|
||||
for k, v in self._default_config.items():
|
||||
self.set_value(k, v)
|
||||
# Only bother setting the value if it differs
|
||||
if self._current_config[k] != v:
|
||||
self.set_value(k, v)
|
||||
self._current_config[k] = v
|
||||
|
||||
self.reload()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user