commit eb74aecbe305c995ca77d532c4be723f2083c149 Author: juga0 juga@riseup.net Date: Tue Jan 8 15:42:24 2019 +0000
scanner: catch exception when stopping scanner --- sbws/core/scanner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py index 7246f12..f16b148 100644 --- a/sbws/core/scanner.py +++ b/sbws/core/scanner.py @@ -39,9 +39,11 @@ def timed_recv_from_server(session, dest, byte_range): try: requests_utils.get( session, dest.url, headers=headers, verify=dest.verify) - except requests.exceptions.ConnectionError as e: - return False, e - except requests.exceptions.ReadTimeout as e: + # NewConnectionError will be raised when shutting down. + except (requests.exceptions.ConnectionError, + requests.exceptions.ReadTimeout, + requests.exceptions.NewConnectionError) as e: + log.debug(e) return False, e end_time = time.time() return True, end_time - start_time