mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-20 19:12:33 +01:00
auto-t: hwsim: wait for method return
It is not safe to assume that the python dbus implementation will wait for a method to return. The documentation says this with respect to reply_handler/error_handler: "If both are None, the implementation may request that no reply is sent" To stay on the safe side we should always include the error/reply handlers and wait for the operation to complete.
This commit is contained in:
parent
199b7837d4
commit
0036cb976f
@ -58,7 +58,9 @@ class Rule(HwsimDBusAbstract):
|
|||||||
|
|
||||||
@source.setter
|
@source.setter
|
||||||
def source(self, value):
|
def source(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Source', value)
|
self._prop_proxy.Set(self._iface_name, 'Source', value, reply_handler=self._success,
|
||||||
|
error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def destination(self):
|
def destination(self):
|
||||||
@ -66,7 +68,9 @@ class Rule(HwsimDBusAbstract):
|
|||||||
|
|
||||||
@destination.setter
|
@destination.setter
|
||||||
def destination(self, value):
|
def destination(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Destination', value)
|
self._prop_proxy.Set(self._iface_name, 'Destination', value, reply_handler=self._success,
|
||||||
|
error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bidirectional(self):
|
def bidirectional(self):
|
||||||
@ -75,7 +79,8 @@ class Rule(HwsimDBusAbstract):
|
|||||||
@bidirectional.setter
|
@bidirectional.setter
|
||||||
def bidirectional(self, value):
|
def bidirectional(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Bidirectional',
|
self._prop_proxy.Set(self._iface_name, 'Bidirectional',
|
||||||
dbus.Boolean(value))
|
dbus.Boolean(value), reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def frequency(self):
|
def frequency(self):
|
||||||
@ -84,7 +89,8 @@ class Rule(HwsimDBusAbstract):
|
|||||||
@frequency.setter
|
@frequency.setter
|
||||||
def frequency(self, value):
|
def frequency(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Frequency',
|
self._prop_proxy.Set(self._iface_name, 'Frequency',
|
||||||
dbus.UInt32(value))
|
dbus.UInt32(value), reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def priority(self):
|
def priority(self):
|
||||||
@ -93,7 +99,8 @@ class Rule(HwsimDBusAbstract):
|
|||||||
@priority.setter
|
@priority.setter
|
||||||
def priority(self, value):
|
def priority(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Priority',
|
self._prop_proxy.Set(self._iface_name, 'Priority',
|
||||||
dbus.Int16(value))
|
dbus.Int16(value), reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def signal(self):
|
def signal(self):
|
||||||
@ -102,7 +109,8 @@ class Rule(HwsimDBusAbstract):
|
|||||||
@signal.setter
|
@signal.setter
|
||||||
def signal(self, value):
|
def signal(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'SignalStrength',
|
self._prop_proxy.Set(self._iface_name, 'SignalStrength',
|
||||||
dbus.Int16(value))
|
dbus.Int16(value), reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def drop(self):
|
def drop(self):
|
||||||
@ -110,7 +118,9 @@ class Rule(HwsimDBusAbstract):
|
|||||||
|
|
||||||
@drop.setter
|
@drop.setter
|
||||||
def drop(self, value):
|
def drop(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Drop', dbus.Boolean(value))
|
self._prop_proxy.Set(self._iface_name, 'Drop', dbus.Boolean(value),
|
||||||
|
reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delay(self):
|
def delay(self):
|
||||||
@ -118,7 +128,9 @@ class Rule(HwsimDBusAbstract):
|
|||||||
|
|
||||||
@delay.setter
|
@delay.setter
|
||||||
def delay(self, value):
|
def delay(self, value):
|
||||||
self._prop_proxy.Set(self._iface_name, 'Delay', dbus.UInt32(value))
|
self._prop_proxy.Set(self._iface_name, 'Delay', dbus.UInt32(value),
|
||||||
|
reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
self._iface.Remove(reply_handler=self._success,
|
self._iface.Remove(reply_handler=self._success,
|
||||||
@ -126,6 +138,9 @@ class Rule(HwsimDBusAbstract):
|
|||||||
|
|
||||||
self._wait_for_async_op()
|
self._wait_for_async_op()
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.remove()
|
||||||
|
|
||||||
def __str__(self, prefix = ''):
|
def __str__(self, prefix = ''):
|
||||||
return prefix + 'Rule: ' + self.path + '\n' + \
|
return prefix + 'Rule: ' + self.path + '\n' + \
|
||||||
prefix + '\tSource:\t\t' + self.source + '\n' + \
|
prefix + '\tSource:\t\t' + self.source + '\n' + \
|
||||||
|
Loading…
Reference in New Issue
Block a user