diff options
author | Robey Pointer <robey@lag.net> | 2005-11-11 17:43:01 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-11-11 17:43:01 +0000 |
commit | 7e95e2afc8200b82a352f6f5f0935286c1a0f352 (patch) | |
tree | 8a3f10beef19064aa67da4f5b04f75e5b2c08963 | |
parent | 42867ded4247f7fcd66aa0907f85a1660d931612 (diff) |
[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-79]
in Transport.__del__, don't try to clean up attributes that were never created
-rw-r--r-- | paramiko/transport.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py index 9609773e..32436f4a 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -502,9 +502,13 @@ class Transport (threading.Thread): Close this session, and any open channels that are tied to it. """ self.active = False - self.packetizer.close() - for chan in self.channels.values(): - chan._unlink() + # since this may be called from __del__, can't assume any attributes exist + try: + self.packetizer.close() + for chan in self.channels.values(): + chan._unlink() + except AttributeError: + pass def get_remote_server_key(self): """ @@ -1576,7 +1580,6 @@ class Transport (threading.Thread): # it's now okay to send data again (if this was a re-key) if not self.packetizer.need_rekey(): self.in_kex = False - self._log(DEBUG, 'clear to send') self.clear_to_send_lock.acquire() try: self.clear_to_send.set() |