mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 12:52:49 +01:00
auto-t: AdHoc - address race condition
The AdHoc methods used to miss the change in properties on AdHoc interface. To address the race condition, we subscribe 'PropertiesChanged' signal first and then do GetAll properties call. This way we are not missing 'PropertiesChanged' signal in between these calls.
This commit is contained in:
parent
588848651a
commit
20ac57783b
@ -468,11 +468,6 @@ class Device(IWDDBusAbstract):
|
||||
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
|
||||
|
||||
def adhoc_wait_for_disconnected(self, addr):
|
||||
props = self._prop_proxy.GetAll(IWD_ADHOC_INTERFACE)
|
||||
if props.get('ConnectedPeers', None):
|
||||
if addr not in props['ConnectedPeers']:
|
||||
return
|
||||
|
||||
self._adhoc_prop_found = False
|
||||
self._adhoc_timed_out = False
|
||||
|
||||
@ -487,6 +482,10 @@ class Device(IWDDBusAbstract):
|
||||
|
||||
self._prop_proxy.connect_to_signal('PropertiesChanged',
|
||||
adhoc_props_changed)
|
||||
props = self._prop_proxy.GetAll(IWD_ADHOC_INTERFACE)
|
||||
if props.get('ConnectedPeers', None):
|
||||
if addr not in props['ConnectedPeers']:
|
||||
return
|
||||
|
||||
GLib.timeout_add(int(30 * 1000), wait_timeout_cb)
|
||||
context = mainloop.get_context()
|
||||
@ -496,11 +495,6 @@ class Device(IWDDBusAbstract):
|
||||
raise TimeoutError("Timed out waiting for peer %s" % addr)
|
||||
|
||||
def adhoc_wait_for_connected(self, addr):
|
||||
props = self._prop_proxy.GetAll(IWD_ADHOC_INTERFACE)
|
||||
if props.get('ConnectedPeers', None):
|
||||
if addr in props['ConnectedPeers']:
|
||||
return
|
||||
|
||||
self._adhoc_prop_found = False
|
||||
self._adhoc_timed_out = False
|
||||
|
||||
@ -516,6 +510,11 @@ class Device(IWDDBusAbstract):
|
||||
self._prop_proxy.connect_to_signal('PropertiesChanged',
|
||||
adhoc_props_changed)
|
||||
|
||||
props = self._prop_proxy.GetAll(IWD_ADHOC_INTERFACE)
|
||||
if props.get('ConnectedPeers', None):
|
||||
if addr in props['ConnectedPeers']:
|
||||
return
|
||||
|
||||
GLib.timeout_add(int(15 * 1000), wait_timeout_cb)
|
||||
context = mainloop.get_context()
|
||||
while not self._adhoc_prop_found:
|
||||
|
Loading…
Reference in New Issue
Block a user