diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2022-06-03 19:55:48 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2022-06-03 19:55:48 -0400 |
commit | 05add162f9484387f1a075dbf4dac58300e3adae (patch) | |
tree | 1740fa6577a4f00f159d5b283ade255ad2def54a /paramiko/client.py | |
parent | a9ce285b03cf977c76cde01cb4b67101d74fb4d3 (diff) | |
parent | bc4f2703d35fc639b7dff9ebf66902261f5087de (diff) | |
download | paramiko-2.9.tar.gz |
Merge branch '2.8' into 2.92.9
Diffstat (limited to 'paramiko/client.py')
-rw-r--r-- | paramiko/client.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/paramiko/client.py b/paramiko/client.py index 80c956cd..c3cbcb9d 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -350,6 +350,10 @@ class SSHClient(ClosingContextManager): # Break out of the loop on success break except socket.error as e: + # As mentioned in socket docs it is better + # to close sockets explicitly + if sock: + sock.close() # Raise anything that isn't a straight up connection error # (such as a resolution error) if e.errno not in (ECONNREFUSED, EHOSTUNREACH): |