防止吓人~

This commit is contained in:
ubuntu 2018-08-29 13:57:54 +08:00
parent e80575bf12
commit 41fba68a17
2 changed files with 10 additions and 2 deletions

@ -171,7 +171,11 @@ def _ping_thread(host, mark):
if 'ttl' not in output.readline():
lostCount += 1
allCount += 1
lostRate[mark] = float(lostCount) / allCount
# 防止吓人
if allCount < 100:
lostRate[mark] = 0.00
else:
lostRate[mark] = float(lostCount) / allCount
endTime = time.time()
if endTime-startTime > 3600:
lostCount = 0

@ -140,7 +140,11 @@ def _ping_thread(host, mark):
if 'TTL' not in output.readline().upper():
lostCount += 1
allCount += 1
lostRate[mark] = float(lostCount) / allCount
# 防止吓人
if allCount < 100:
lostRate[mark] = 0.00
else:
lostRate[mark] = float(lostCount) / allCount
endTime = time.time()
if endTime-startTime > 3600:
lostCount = 0