Commit 012a6ab3 authored by Alexandre's avatar Alexandre
Browse files

Catch new exception

parent 1a33d71c
......@@ -522,7 +522,7 @@ def run_default(name, connection, opts):
if not opts.pipelining:
try:
connection.do_test(request, synchronous = not opts.multistreams)
except (OpenSSL.SSL.Error, homer.DOHException) as e:
except (OpenSSL.SSL.Error, homer.ConnectionDOTException, homer.DOHException) as e:
ok = False
error(e)
break
......@@ -542,28 +542,38 @@ def run_default(name, connection, opts):
if opts.dot and opts.pipelining:
print()
done = 0
current = connection.pipelining_init_pending(opts.max_in_flight)
while done < opts.tests:
if time.time() > start + homer.MAX_DURATION: # if we send thousands of requests
# MAX_DURATION will be reached
# need to increase MAX_DURATION based
# on the number of queries
# or to define a relation such as
# f(tests) = MAX_DURATION
print("Elapsed time too long, %i requests never got a reply" % (opts.tests-done))
ok = False
break
id = connection.read_result(connection, connection.pending, display_results=opts.display_results)
if id is None: # Probably a timeout
time.sleep(homer.SLEEP_TIMEOUT)
continue
done += 1
over, rank, request = connection.pending[id]
if not over:
error("Internal error, request %i should be over" % id)
if current < len(connection.all_requests):
connection.pipelining_fill_pending(current)
current += 1
try:
current = connection.pipelining_init_pending(opts.max_in_flight)
except homer.ConnectionDOTException as e:
ok = False
error(e)
else:
while done < opts.tests:
if time.time() > start + homer.MAX_DURATION: # if we send thousands of requests
# MAX_DURATION will be reached
# need to increase MAX_DURATION based
# on the number of queries
# or to define a relation such as
# f(tests) = MAX_DURATION
print("Elapsed time too long, %i requests never got a reply" % (opts.tests-done))
ok = False
break
id = connection.read_result(connection, connection.pending, display_results=opts.display_results)
if id is None: # Probably a timeout
time.sleep(homer.SLEEP_TIMEOUT)
continue
done += 1
over, rank, request = connection.pending[id]
if not over:
error("Internal error, request %i should be over" % id)
if current < len(connection.all_requests):
try:
connection.pipelining_fill_pending(current)
except homer.ConnectionDOTException as e:
ok = False
error(e)
break
current += 1
stop = time.time()
if opts.tests > 1 and not opts.pipelining and not opts.multistreams:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment