diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2022-06-03 19:55:51 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2022-06-03 19:55:51 -0400 |
commit | 0f3beefa5618ca46ea880eca696dca488fcc2bb6 (patch) | |
tree | aae2a285cc2821c7e2b042bf28e2d2a08f0b74d5 /paramiko | |
parent | 00fce050cb33fb5ec1f13811c1ad8188cf11645d (diff) | |
parent | 92920c113740d768ccb311b103fdd744389304b1 (diff) | |
download | paramiko-0f3beefa5618ca46ea880eca696dca488fcc2bb6.tar.gz |
Merge branch '2.10' into 2.11
Diffstat (limited to 'paramiko')
-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 581f9b6f..92feaa1f 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): |