Unverified Commit 76e8a704 authored by ttbachyinsda's avatar ttbachyinsda Committed by GitHub
Browse files

[Minor fix] The domain dns.google may cause a socket.gaierror exception (#3176)


Co-authored-by: default avatarguofangze <guofangze@kuaishou.com>
parent 9cbc7e5f
...@@ -173,7 +173,7 @@ def get_ip() -> str: ...@@ -173,7 +173,7 @@ def get_ip() -> str:
# try ipv4 # try ipv4
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try: try:
s.connect(("dns.google", 80)) # Doesn't need to be reachable s.connect(("8.8.8.8", 80)) # Doesn't need to be reachable
return s.getsockname()[0] return s.getsockname()[0]
except OSError: except OSError:
# try ipv6 # try ipv6
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment