diff options
-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() |