[#10877][fix] restore ipv6 support in serve.py (#10929)

Signed-off-by: Evgueni Petrov <evgueni.s.petrov@gmail.com>
This commit is contained in:
Evgueni Petrov 2026-01-28 02:55:59 +07:00 committed by GitHub
parent bae2fac834
commit f25a2c53bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -186,7 +186,11 @@ def launch_server(
backend = llm_args["backend"]
model = llm_args["model"]
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
addr_info = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
socket.SOCK_STREAM)
address_family = socket.AF_INET6 if all(
[info[0] == socket.AF_INET6 for info in addr_info]) else socket.AF_INET
with socket.socket(address_family, socket.SOCK_STREAM) as s:
# If disagg cluster config is provided and port is not specified, try to find a free port, otherwise try to bind to the specified port
assert port > 0 or disagg_cluster_config is not None, "Port must be specified if disagg cluster config is not provided"
try: