Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore ENOTCONN during shutdown #712

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions kmip/services/server/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# under the License.

import binascii
import errno
import logging
import socket
import struct
Expand Down Expand Up @@ -113,8 +114,13 @@ def run(self):
self._logger.info("Failure handling message loop")
self._logger.exception(e)

self._connection.shutdown(socket.SHUT_RDWR)
self._connection.close()
try:
self._connection.shutdown(socket.SHUT_RDWR)
except OSError as e:
if e.errno != errno.ENOTCONN:
raise
finally:
self._connection.close()
self._logger.info("Stopping session: {0}".format(self.name))

def _handle_message_loop(self):
Expand Down
Loading