Skip to content

Commit

Permalink
[project @ robey@lag.net-20061112063054-bf71926ff8c98c68]
Browse files Browse the repository at this point in the history
a bit of cleanup in close() to try harder to avoid having lingering threads
  • Loading branch information
Robey Pointer committed Nov 12, 2006
1 parent e2d8357 commit 48afc30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paramiko/channel.py
Expand Up @@ -92,7 +92,10 @@ def __init__(self, chanid):
self.exit_status = -1

def __del__(self):
self.close()
try:
self.close()
except:
pass

def __repr__(self):
"""
Expand Down
1 change: 1 addition & 0 deletions paramiko/packet.py
Expand Up @@ -149,6 +149,7 @@ def set_inbound_compressor(self, compressor):

def close(self):
self.__closed = True
self.__socket.close()

def set_hexdump(self, hexdump):
self.__dump_packets = hexdump
Expand Down
3 changes: 3 additions & 0 deletions paramiko/transport.py
Expand Up @@ -543,10 +543,13 @@ def close(self):
"""
Close this session, and any open channels that are tied to it.
"""
if not self.active:
return
self.active = False
self.packetizer.close()
for chan in self.channels.values():
chan._unlink()
self.join()

def get_remote_server_key(self):
"""
Expand Down

0 comments on commit 48afc30

Please sign in to comment.