[Utils] Move network/socket utilities from common.py to network.py (#20646)

This commit is contained in:
Liangsheng Yin
2026-03-15 20:35:24 -07:00
committed by GitHub
parent afc71bae3a
commit f0458e0b49
28 changed files with 418 additions and 422 deletions

View File

@@ -401,7 +401,7 @@ def reserve_port(host, start=30000, end=40000):
Reserve an available port by trying to bind a socket.
Returns a tuple (port, lock_socket) where `lock_socket` is kept open to hold the lock.
"""
from sglang.srt.utils.common import try_bind_socket
from sglang.srt.utils.network import try_bind_socket
candidates = list(range(start, end))
random.shuffle(candidates)