a bit of cleanup in close() to try harder to avoid having lingering threads
This commit is contained in:
parent
e2d8357622
commit
48afc3082a
|
@ -92,7 +92,10 @@ class Channel (object):
|
||||||
self.exit_status = -1
|
self.exit_status = -1
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.close()
|
try:
|
||||||
|
self.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -149,6 +149,7 @@ class Packetizer (object):
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.__closed = True
|
self.__closed = True
|
||||||
|
self.__socket.close()
|
||||||
|
|
||||||
def set_hexdump(self, hexdump):
|
def set_hexdump(self, hexdump):
|
||||||
self.__dump_packets = hexdump
|
self.__dump_packets = hexdump
|
||||||
|
|
|
@ -543,10 +543,13 @@ class Transport (threading.Thread):
|
||||||
"""
|
"""
|
||||||
Close this session, and any open channels that are tied to it.
|
Close this session, and any open channels that are tied to it.
|
||||||
"""
|
"""
|
||||||
|
if not self.active:
|
||||||
|
return
|
||||||
self.active = False
|
self.active = False
|
||||||
self.packetizer.close()
|
self.packetizer.close()
|
||||||
for chan in self.channels.values():
|
for chan in self.channels.values():
|
||||||
chan._unlink()
|
chan._unlink()
|
||||||
|
self.join()
|
||||||
|
|
||||||
def get_remote_server_key(self):
|
def get_remote_server_key(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue