From b2141cd93cee7d11173c2aa27f5737eb4734e8d4 Mon Sep 17 00:00:00 2001 From: ubuntu <ubuntu@ubuntu.com> Date: Wed, 29 Aug 2018 17:00:21 +0800 Subject: [PATCH] update client --- clients/client-linux.py | 5 ++++- clients/client-psutil.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clients/client-linux.py b/clients/client-linux.py index 010ca9e..af23c85 100755 --- a/clients/client-linux.py +++ b/clients/client-linux.py @@ -168,7 +168,10 @@ def _ping_thread(host, mark): startTime = time.time() output.readline() while True: - if 'ttl' not in output.readline(): + buffer = output.readline() + if len(buffer) == 0: + return + if 'ttl' not in buffer: lostCount += 1 allCount += 1 # 防止吓人 diff --git a/clients/client-psutil.py b/clients/client-psutil.py index cf783a5..194bef0 100755 --- a/clients/client-psutil.py +++ b/clients/client-psutil.py @@ -137,7 +137,10 @@ def _ping_thread(host, mark): output.readline() output.readline() while True: - if 'TTL' not in output.readline().upper(): + buffer = output.readline() + if len(buffer) == 0: + return + if 'TTL' not in buffer.upper(): lostCount += 1 allCount += 1 # 防止吓人