From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 4/6] auto-t: allow configurable DBus timeout/callbacks on connect{_bssid}
Date: Wed, 28 May 2025 13:10:24 -0700 [thread overview]
Message-ID: <20250528201026.598221-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20250528201026.598221-1-prestwoj@gmail.com>
Let the caller specify the method timeout if there is an expectation
that it could take a long time.
For the conventional connect call (not the "bssid" debug variant) let
them pass their own callback handlers. This is useful if we don't
want to wait for the connect call to finish, but later get some
indication that it did finish either successfully or not.
---
autotests/util/iwd.py | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 9091807a..37eb4943 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -112,8 +112,8 @@ class AsyncOpAbstract(object):
self._is_completed = True
self._exception = _convert_dbus_ex(ex)
- def _wait_for_async_op(self):
- ctx.non_block_wait(lambda s: s._is_completed, 30, self, exception=None)
+ def _wait_for_async_op(self, timeout=50):
+ ctx.non_block_wait(lambda s: s._is_completed, timeout, self, exception=None)
self._is_completed = False
if self._exception is not None:
@@ -280,8 +280,15 @@ class StationDebug(IWDDBusAbstract):
def autoconnect(self):
return self._properties['AutoConnect']
- def connect_bssid(self, address):
- self._iface.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', '')))
+ def connect_bssid(self, address, wait=True):
+ self._iface.ConnectBssid(
+ dbus.ByteArray.fromhex(address.replace(':', '')),
+ reply_handler=self._success,
+ error_handler=self._failure
+ )
+
+ if wait:
+ self._wait_for_async_op()
def roam(self, address):
self._iface.Roam(dbus.ByteArray.fromhex(address.replace(':', '')))
@@ -870,8 +877,8 @@ class Device(IWDDBusAbstract):
def stop_adhoc(self):
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
- def connect_bssid(self, address):
- self._station_debug.connect_bssid(address)
+ def connect_bssid(self, address, wait=True):
+ self._station_debug.connect_bssid(address, wait=wait)
def roam(self, address):
self._station_debug.roam(address)
@@ -999,7 +1006,7 @@ class Network(IWDDBusAbstract):
def extended_service_set(self):
return self._properties['ExtendedServiceSet']
- def connect(self, wait=True):
+ def connect(self, wait=True, timeout=50, reply_handler=None, error_handler=None):
'''
Connect to the network. Request the device implied by the object
path to connect to specified network.
@@ -1014,12 +1021,19 @@ class Network(IWDDBusAbstract):
@rtype: void
'''
+ if not reply_handler:
+ reply_handler = self._success
+
+ if not error_handler:
+ error_handler = self._failure
+
self._iface.Connect(dbus_interface=self._iface_name,
- reply_handler=self._success,
- error_handler=self._failure)
+ reply_handler=reply_handler,
+ error_handler=error_handler,
+ timeout=timeout)
if wait:
- self._wait_for_async_op()
+ self._wait_for_async_op(timeout=timeout)
def __str__(self, prefix = ''):
return prefix + 'Network:\n' \
--
2.34.1
next prev parent reply other threads:[~2025-05-28 20:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 20:10 [PATCH v2 1/6] network: make clearing network blacklist a separate operation James Prestwood
2025-05-28 20:10 ` [PATCH v2 2/6] station: fix DBus reply for Connect() with netconfig James Prestwood
2025-05-28 20:10 ` [PATCH v2 3/6] station: include netconfig as part of the BSS retry logic James Prestwood
2025-05-28 20:10 ` James Prestwood [this message]
2025-05-28 20:10 ` [PATCH v2 5/6] auto-t: update several tests to work with netconfig refactor James Prestwood
2025-05-28 20:10 ` [PATCH v2 6/6] doc: add note about timeouts to Network.Connect() James Prestwood
2025-06-05 15:02 ` [PATCH v2 1/6] network: make clearing network blacklist a separate operation Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250528201026.598221-4-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox