Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
88752c93
Commit
88752c93
authored
Feb 27, 2019
by
juga
Browse files
scanner: log any exception raised by main_loop
before stopping the scanner.
parent
14b8ccf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/core/scanner.py
View file @
88752c93
...
...
@@ -36,6 +36,9 @@ pool = None
rd
=
None
controller
=
None
FILLUP_TICKET_MSG
=
"""Something went wrong.
Please create a ticket in https://trac.torproject.org with this traceback."""
def
stop_threads
(
signal
,
frame
,
exit_code
=
0
):
global
rd
,
pool
...
...
@@ -540,14 +543,18 @@ def run_speedtest(args, conf):
fail_hard
(
error_msg
)
max_pending_results
=
conf
.
getint
(
'scanner'
,
'measurement_threads'
)
pool
=
Pool
(
max_pending_results
)
try
:
main_loop
(
args
,
conf
,
controller
,
rl
,
cb
,
rd
,
rp
,
destinations
,
max_pending_results
,
pool
)
except
KeyboardInterrupt
:
log
.
info
(
"Interrupted by the user."
)
finally
:
stop_threads
(
signal
.
SIGINT
,
None
)
# Any exception not catched at this point would make the scanner stall.
# Log it and exit gracefully.
except
Exception
as
e
:
log
.
critical
(
FILLUP_TICKET_MSG
)
log
.
exception
(
e
)
stop_threads
(
signal
.
SIGTERM
,
None
,
1
)
def
gen_parser
(
sub
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment