mirror of
https://github.com//cppla/ServerStatus
synced 2025-07-04 16:35:58 +08:00
flush dns , every time
This commit is contained in:
parent
9077f1058a
commit
5cfd533daf
@ -155,17 +155,18 @@ def _ping_thread(host, mark, port):
|
|||||||
lostPacket = 0
|
lostPacket = 0
|
||||||
packet_queue = Queue(maxsize=PING_PACKET_HISTORY_LEN)
|
packet_queue = Queue(maxsize=PING_PACKET_HISTORY_LEN)
|
||||||
|
|
||||||
IP = host
|
while True:
|
||||||
if host.count(':') < 1: # if not plain ipv6 address, means ipv4 address or hostname
|
# flush dns , every time.
|
||||||
try:
|
IP = host
|
||||||
if PROBE_PROTOCOL_PREFER == 'ipv4':
|
if host.count(':') < 1: # if not plain ipv6 address, means ipv4 address or hostname
|
||||||
IP = socket.getaddrinfo(host, None, socket.AF_INET)[0][4][0]
|
try:
|
||||||
else:
|
if PROBE_PROTOCOL_PREFER == 'ipv4':
|
||||||
IP = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0]
|
IP = socket.getaddrinfo(host, None, socket.AF_INET)[0][4][0]
|
||||||
except Exception:
|
else:
|
||||||
|
IP = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0]
|
||||||
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
while True:
|
|
||||||
if packet_queue.full():
|
if packet_queue.full():
|
||||||
if packet_queue.get() == 0:
|
if packet_queue.get() == 0:
|
||||||
lostPacket -= 1
|
lostPacket -= 1
|
||||||
|
@ -153,17 +153,18 @@ def _ping_thread(host, mark, port):
|
|||||||
lostPacket = 0
|
lostPacket = 0
|
||||||
packet_queue = Queue(maxsize=PING_PACKET_HISTORY_LEN)
|
packet_queue = Queue(maxsize=PING_PACKET_HISTORY_LEN)
|
||||||
|
|
||||||
IP = host
|
while True:
|
||||||
if host.count(':') < 1: # if not plain ipv6 address, means ipv4 address or hostname
|
# flush dns, every time.
|
||||||
try:
|
IP = host
|
||||||
if PROBE_PROTOCOL_PREFER == 'ipv4':
|
if host.count(':') < 1: # if not plain ipv6 address, means ipv4 address or hostname
|
||||||
IP = socket.getaddrinfo(host, None, socket.AF_INET)[0][4][0]
|
try:
|
||||||
else:
|
if PROBE_PROTOCOL_PREFER == 'ipv4':
|
||||||
IP = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0]
|
IP = socket.getaddrinfo(host, None, socket.AF_INET)[0][4][0]
|
||||||
except Exception:
|
else:
|
||||||
|
IP = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0]
|
||||||
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
while True:
|
|
||||||
if packet_queue.full():
|
if packet_queue.full():
|
||||||
if packet_queue.get() == 0:
|
if packet_queue.get() == 0:
|
||||||
lostPacket -= 1
|
lostPacket -= 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user