mirror of https://github.com/OpenKMIP/PyKMIP.git
Ignore ENOTCONN during shutdown
This commit is contained in:
parent
9d5b287f4c
commit
6cd44b572b
|
@ -14,6 +14,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
@ -113,7 +114,12 @@ class KmipSession(threading.Thread):
|
||||||
self._logger.info("Failure handling message loop")
|
self._logger.info("Failure handling message loop")
|
||||||
self._logger.exception(e)
|
self._logger.exception(e)
|
||||||
|
|
||||||
|
try:
|
||||||
self._connection.shutdown(socket.SHUT_RDWR)
|
self._connection.shutdown(socket.SHUT_RDWR)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.ENOTCONN:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
self._connection.close()
|
self._connection.close()
|
||||||
self._logger.info("Stopping session: {0}".format(self.name))
|
self._logger.info("Stopping session: {0}".format(self.name))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue