Issue #28174: Handle when SO_REUSEPORT isn't properly supported (asyncio)

Patch by Seth Michael Larson.
This commit is contained in:
Yury Selivanov 2016-09-15 15:45:07 -04:00
parent a1b0e7db73
commit 5587d7c071
3 changed files with 27 additions and 12 deletions

View file

@ -1370,6 +1370,17 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self.assertRaises(ValueError, self.loop.run_until_complete, f)
@patch_socket
def test_create_server_soreuseport_only_defined(self, m_socket):
m_socket.getaddrinfo = socket.getaddrinfo
m_socket.socket.return_value = mock.Mock()
m_socket.SO_REUSEPORT = -1
f = self.loop.create_server(
MyProto, '0.0.0.0', 0, reuse_port=True)
self.assertRaises(ValueError, self.loop.run_until_complete, f)
@patch_socket
def test_create_server_cant_bind(self, m_socket):