[connection.py] less if condition

Signed-off-by: XiaoliChan <2209553467@qq.com>
main
XiaoliChan 2023-10-24 00:23:51 +08:00
parent 6ac9f7f0a5
commit a037ac9f4a
1 changed files with 2 additions and 5 deletions

View File

@ -31,11 +31,8 @@ def gethost_addrinfo(hostname):
}
for res in getaddrinfo(hostname, None, AF_UNSPEC, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME):
af, socktype, proto, canonname, sa = res
if af.name == "AF_INET6":
address_info["AF_INET6"] = sa[0]
else:
address_info["AF_INET"] = sa[0]
af, _, _, canonname, sa = res
address_info[af.name] = sa[0]
# IPv4 preferred
if address_info["AF_INET"]: