a bit of cleanup in close() to try harder to avoid having lingering threads
This commit is contained in:
Robey Pointer 2006-11-11 22:30:54 -08:00
parent e2d8357622
commit 48afc3082a
3 changed files with 8 additions and 1 deletions

View File

@ -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):
""" """

View File

@ -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

View File

@ -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):
""" """