1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

target: Ensure max_async is used during connect method

The value for `max_async` when creating a target was being ignored
if a connection was not established as part of the __init__ method.
Save this value for use via `connect` if called directly.
This commit is contained in:
Marc Bonnici 2023-01-31 18:24:56 +00:00
parent 93ada9762d
commit 7f778e767d

View File

@ -344,6 +344,7 @@ class Target(object):
self._cache = {}
self._shutils = None
self._file_transfer_cache = None
self._max_async = max_async
self.busybox = None
if load_default_modules:
@ -387,7 +388,7 @@ class Target(object):
# connection and initialization
@asyn.asyncf
async def connect(self, timeout=None, check_boot_completed=True, max_async=50):
async def connect(self, timeout=None, check_boot_completed=True, max_async=None):
self.platform.init_target_connection(self)
# Forcefully set the thread-local value for the connection, with the
# timeout we want
@ -400,7 +401,7 @@ class Target(object):
self.execute('mkdir -p {}'.format(quote(self.executables_directory)))
self.busybox = self.install(os.path.join(PACKAGE_BIN_DIRECTORY, self.abi, 'busybox'), timeout=30)
self.conn.busybox = self.busybox
self._detect_max_async(max_async)
self._detect_max_async(max_async or self._max_async)
self.platform.update_from_target(self)
self._update_modules('connected')
if self.platform.big_core and self.load_default_modules:
@ -1824,7 +1825,7 @@ class AndroidTarget(Target):
raise TargetStableError('Connected but Android did not fully boot.')
@asyn.asyncf
async def connect(self, timeout=30, check_boot_completed=True, max_async=50): # pylint: disable=arguments-differ
async def connect(self, timeout=30, check_boot_completed=True, max_async=None): # pylint: disable=arguments-differ
device = self.connection_settings.get('device')
await super(AndroidTarget, self).connect.asyn(
timeout=timeout,
@ -2998,7 +2999,7 @@ class ChromeOsTarget(LinuxTarget):
else:
raise
def connect(self, timeout=30, check_boot_completed=True, max_async=50):
def connect(self, timeout=30, check_boot_completed=True, max_async=None):
super(ChromeOsTarget, self).connect(
timeout=timeout,
check_boot_completed=check_boot_completed,