mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +00: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:
parent
f5f06122f3
commit
7714acc897
@ -521,6 +521,13 @@ class Target(object):
|
|||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
connections = self._conn.get_all_values()
|
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):
|
for conn in itertools.chain(connections, self._unused_conns):
|
||||||
conn.close()
|
conn.close()
|
||||||
if self._async_pool is not None:
|
if self._async_pool is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user