mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #33860 from cachedout/issue_33843
Allow socket closes when the socket is disconnected
This commit is contained in:
commit
669aa92d59
1 changed files with 10 additions and 1 deletions
|
@ -17,6 +17,7 @@ import weakref
|
|||
import urlparse # TODO: remove
|
||||
import time
|
||||
import traceback
|
||||
import errno
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.crypt
|
||||
|
@ -432,7 +433,15 @@ class TCPReqServerChannel(salt.transport.mixins.auth.AESReqServerMixin, salt.tra
|
|||
|
||||
def close(self):
|
||||
if self._socket is not None:
|
||||
self._socket.shutdown(socket.SHUT_RDWR)
|
||||
try:
|
||||
self._socket.shutdown(socket.SHUT_RDWR)
|
||||
except socket.error as exc:
|
||||
if exc.errno == errno.ENOTCONN:
|
||||
# We may try to shutdown a socket which is already disconnected.
|
||||
# Ignore this condition and continue.
|
||||
pass
|
||||
else:
|
||||
raise exc
|
||||
self._socket.close()
|
||||
self._socket = None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue