diff options
author | Profpatsch <mail@profpatsch.de> | 2017-07-07 22:08:19 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2017-07-07 22:10:29 +0200 |
commit | ea5bd2fe12e6fb13a9a74fb95ad930fb4f0292b5 (patch) | |
tree | e37883d541bfa767872073820f7f828207c508ac /modules/user/openlab | |
parent | 3d8772d45dc7cf05ab19c47011475da6ebd66ea2 (diff) |
modules/openlab: small patch to speedtest for more correct ping
Diffstat (limited to 'modules/user/openlab')
-rwxr-xr-x | modules/user/openlab/speedtest.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/user/openlab/speedtest.py b/modules/user/openlab/speedtest.py index 6868263b..16ac8ae3 100755 --- a/modules/user/openlab/speedtest.py +++ b/modules/user/openlab/speedtest.py @@ -15,13 +15,14 @@ PING_BIN = "ping" dns = 0 == sub.run([HOST_BIN, "-W1", DOMAIN], stdout=sub.DEVNULL).returncode -ping = 0 == sub.run([PING_BIN, "-w1", "-W1", "-c1", DOMAIN], +hostname = DOMAIN if dns else IP + +ping = 0 == sub.run([PING_BIN, "-w1", "-W1", "-c1", hostname], stdout=sub.DEVNULL).returncode bytes_per_sec = 0 if ping == True: - d = DOMAIN if dns else IP - res = sub.run(["curl", "--silent", PROTOCOL + "://" + d + FILE, + res = sub.run(["curl", "--silent", PROTOCOL + "://" + hostname + FILE, "--write-out", "\n%{speed_download}"], stdout=sub.PIPE, stderr=sub.PIPE) if res.returncode != 0: |