Use threadsperurl when requesting the server list

This commit is contained in:
Matt Martz 2015-05-15 10:04:11 -05:00
parent 51d0d88b96
commit 893f2e126b
1 changed files with 5 additions and 4 deletions

View File

@ -411,7 +411,7 @@ def getConfig():
return config return config
def closestServers(client, all=False): def closestServers(client, download, all=False):
"""Determine the 5 closest speedtest.net servers based on geographic """Determine the 5 closest speedtest.net servers based on geographic
distance distance
""" """
@ -424,7 +424,8 @@ def closestServers(client, all=False):
servers = {} servers = {}
for url in urls: for url in urls:
try: try:
request = build_request(url) request = build_request('%s?threads=%s' %
(url, download['threadsperurl']))
uh, e = catch_request(request) uh, e = catch_request(request)
if e: if e:
errors.append('%s' % e) errors.append('%s' % e)
@ -626,7 +627,7 @@ def speedtest():
if not args.simple: if not args.simple:
print_('Retrieving speedtest.net server list...') print_('Retrieving speedtest.net server list...')
if args.list or args.server: if args.list or args.server:
servers = closestServers(config['client'], True) servers = closestServers(config['client'], config['download'], True)
if args.list: if args.list:
serverList = [] serverList = []
for server in servers: for server in servers:
@ -645,7 +646,7 @@ def speedtest():
pass pass
sys.exit(0) sys.exit(0)
else: else:
servers = closestServers(config['client']) servers = closestServers(config['client'], config['download'])
if not args.simple: if not args.simple:
print_('Testing from %(isp)s (%(ip)s)...' % config['client']) print_('Testing from %(isp)s (%(ip)s)...' % config['client'])