Fixes premature server shutdown on receiving invalid certificate

This change fixes a bug with the server where the server would
prematurely shutdown upon receiving a client connection using an
invalid certificate. The server will now withstand bad client
connections. The impacted server unit tests have been updated to
reflect the bug fix.
This commit is contained in:
Peter Hamilton 2016-12-01 14:23:08 -05:00
parent cba8757f63
commit 94aacc1897
2 changed files with 2 additions and 2 deletions
kmip
services/server
tests/unit/services/server

View File

@ -298,12 +298,12 @@ class KmipServer(object):
except socket.error as e:
if e.errno == errno.EINTR:
self._logger.warning("Interrupting connection service.")
break
else:
self._logger.warning(
"Error detected while establishing new connection."
)
self._logger.exception(e)
break
except Exception as e:
self._logger.warning(
"Error detected while establishing new connection."

View File

@ -381,7 +381,7 @@ class TestKmipServer(testtools.TestCase):
s._is_serving = True
s._logger.reset_mock()
s._socket.accept = mock.MagicMock(
side_effect=[unexpected_error]
side_effect=[unexpected_error, expected_error]
)
s.serve()