diff options
Diffstat (limited to 'waitress/adjustments.py')
| -rw-r--r-- | waitress/adjustments.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/waitress/adjustments.py b/waitress/adjustments.py index 2ee4cd5..1a56621 100644 --- a/waitress/adjustments.py +++ b/waitress/adjustments.py @@ -20,6 +20,7 @@ from waitress.compat import ( PY2, WIN, string_types, + HAS_IPV6, ) truthy = frozenset(('t', 'true', 'y', 'yes', 'on', '1')) @@ -228,10 +229,15 @@ class Adjustments(object): enabled_families = socket.AF_UNSPEC + if not self.ipv4 and not HAS_IPV6: # pragma: no cover + raise ValueError( + 'IPv4 is disabled but IPv6 is not available. Cowardly refusing to start.' + ) + if self.ipv4 and not self.ipv6: enabled_families = socket.AF_INET - if not self.ipv4 and self.ipv6: + if not self.ipv4 and self.ipv6 and HAS_IPV6: enabled_families = socket.AF_INET6 wanted_sockets = [] |
