[paramiko] SSHClient.close should be able to be called multiple time

James Bardin jbardin at bu.edu
Fri Nov 2 14:16:53 PDT 2007


Hi Robey,

Here's a simple patch if you'd like.
I have a finally block that's trying to cleanup open sockets, but in 
some cases SSHClient.close() may be called more than once. Most close 
methods are safe to call multiple times, so I just added this in client.py:


Thanks
-jim





=== modified file 'client.py'
--- client.py   2007-11-02 21:07:21 +0000
+++ client.py   2007-11-02 21:11:18 +0000
@@ -294,6 +294,8 @@
         """
         Close this SSHClient and its underlying L{Transport}.
         """
+        if not self._transport:
+            return
         self._transport.close()
         self._transport = None
 




More information about the paramiko mailing list