perform ICMP pings on posix systems
This commit is contained in:
parent
cbb249b96d
commit
ec41eb5e1d
|
@ -316,8 +316,13 @@ def getBestServer(servers):
|
|||
|
||||
results = {}
|
||||
for server in servers:
|
||||
cum = 0
|
||||
url = os.path.dirname(server['url'])
|
||||
if os.name == 'posix':
|
||||
cmd = 'ping -c 3 ' + url.split('/')[2] + ' | tail -n 1'
|
||||
pingoutput = os.popen(cmd).read()
|
||||
avg = pingoutput.split('/')[4]
|
||||
else:
|
||||
cum = 0
|
||||
for i in range(0, 3):
|
||||
uh = urlopen('%s/latency.txt' % url)
|
||||
start = time.time()
|
||||
|
|
Loading…
Reference in New Issue