fix(PD-disaggregation): Can not get local ip (#6792)

Signed-off-by: storyicon <storyicon@foxmail.com>
This commit is contained in:
storyicon
2025-06-01 04:47:14 +08:00
committed by GitHub
parent 094fbdacd5
commit f90945c45a

View File

@@ -2077,6 +2077,14 @@ def get_local_ip_by_remote() -> str:
except Exception:
pass
try:
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
if ip and ip != "127.0.0.1" and ip != "0.0.0.0":
return ip
except Exception:
pass
# try ipv6
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)