1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-05 18:30:50 +01:00

target: Make Target.disconnect() steal current connections

Ensure the connections that Target.disconnect() closes do not stay
around in case the Target object is later reused.
This commit is contained in:
Douglas Raillard 2024-05-07 10:27:50 +01:00 committed by Marc Bonnici
parent f5f06122f3
commit 7714acc897

View File

@ -521,6 +521,13 @@ class Target(object):
def disconnect(self):
connections = self._conn.get_all_values()
# Now that we have all the connection objects, we simply reset the TLS
# property so that the connections we got will not be reused anywhere.
del self._conn
unused_conns = self._unused_conns
self._unused_conns.clear()
for conn in itertools.chain(connections, self._unused_conns):
conn.close()
if self._async_pool is not None: