Fix internal server on FreeBSD

This commit is contained in:
Unrud 2020-08-18 22:43:59 +02:00
parent f950ce98ab
commit b98cd98c4c
2 changed files with 8 additions and 4 deletions

View File

@ -240,7 +240,9 @@ def serve(configuration, shutdown_socket):
# IPV6_V6ONLY set # IPV6_V6ONLY set
e.errno == errno.EADDRNOTAVAIL or e.errno == errno.EADDRNOTAVAIL or
# Address family not supported # Address family not supported
e.errno == errno.EAFNOSUPPORT)): e.errno == errno.EAFNOSUPPORT or
# Protocol not supported
e.errno == errno.EPROTONOSUPPORT)):
continue continue
raise RuntimeError("Failed to start server %r: %s" % ( raise RuntimeError("Failed to start server %r: %s" % (
format_address(address), e)) from e format_address(address), e)) from e

View File

@ -132,8 +132,9 @@ class TestBaseServerRequests(BaseTest):
socket.EAI_NONAME, server.COMPAT_EAI_ADDRFAMILY, socket.EAI_NONAME, server.COMPAT_EAI_ADDRFAMILY,
server.COMPAT_EAI_NODATA) or server.COMPAT_EAI_NODATA) or
str(exc_info.value) == "address family mismatched" or str(exc_info.value) == "address family mismatched" or
exc_info.value.errno == errno.EADDRNOTAVAIL or exc_info.value.errno in (
exc_info.value.errno == errno.EAFNOSUPPORT) errno.EADDRNOTAVAIL, errno.EAFNOSUPPORT,
errno.EPROTONOSUPPORT))
def test_ipv6(self): def test_ipv6(self):
try: try:
@ -145,7 +146,8 @@ class TestBaseServerRequests(BaseTest):
sock.bind(("::1", 0)) sock.bind(("::1", 0))
self.sockname = sock.getsockname()[:2] self.sockname = sock.getsockname()[:2]
except OSError as e: except OSError as e:
if e.errno in (errno.EADDRNOTAVAIL, errno.EAFNOSUPPORT): if e.errno in (errno.EADDRNOTAVAIL, errno.EAFNOSUPPORT,
errno.EPROTONOSUPPORT):
pytest.skip("IPv6 not supported") pytest.skip("IPv6 not supported")
raise raise
self.configuration.update({ self.configuration.update({