aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/authproxy.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/test_framework/authproxy.py')
-rw-r--r--test/functional/test_framework/authproxy.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py
index 4ba6ac1db2..05308931e3 100644
--- a/test/functional/test_framework/authproxy.py
+++ b/test/functional/test_framework/authproxy.py
@@ -101,23 +101,26 @@ class AuthServiceProxy():
if os.name == 'nt':
# Windows somehow does not like to re-use connections
# TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows
+ # Avoid "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine"
self._set_conn()
try:
self.__conn.request(method, path, postdata, headers)
return self._get_response()
- except http.client.BadStatusLine as e:
- if e.line == "''": # if connection was closed, try again
+ except (BrokenPipeError, ConnectionResetError):
+ # Python 3.5+ raises BrokenPipeError when the connection was reset
+ # ConnectionResetError happens on FreeBSD
+ self.__conn.close()
+ self.__conn.request(method, path, postdata, headers)
+ return self._get_response()
+ except OSError as e:
+ retry = (
+ '[WinError 10053] An established connection was aborted by the software in your host machine' in str(e))
+ if retry:
self.__conn.close()
self.__conn.request(method, path, postdata, headers)
return self._get_response()
else:
raise
- except (BrokenPipeError, ConnectionResetError):
- # Python 3.5+ raises BrokenPipeError instead of BadStatusLine when the connection was reset
- # ConnectionResetError happens on FreeBSD with Python 3.4
- self.__conn.close()
- self.__conn.request(method, path, postdata, headers)
- return self._get_response()
def get_request(self, *args, **argsn):
AuthServiceProxy.__id_count += 1