Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
routersploit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czos-dpend
routersploit
Commits
02355bce
Commit
02355bce
authored
Aug 07, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stopping ThreadPoolExecution from within target function.
parent
a1153f67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
exceptions.py
routersploit/exceptions.py
+4
-0
threads.py
routersploit/threads.py
+7
-2
No files found.
routersploit/exceptions.py
View file @
02355bce
...
@@ -4,3 +4,7 @@ class RoutersploitException(Exception):
...
@@ -4,3 +4,7 @@ class RoutersploitException(Exception):
class
OptionValidationError
(
RoutersploitException
):
class
OptionValidationError
(
RoutersploitException
):
pass
pass
class
StopThreadPoolExecutor
(
RoutersploitException
):
pass
routersploit/threads.py
View file @
02355bce
...
@@ -10,6 +10,7 @@ except ImportError:
...
@@ -10,6 +10,7 @@ except ImportError:
import
Queue
as
queue
import
Queue
as
queue
from
.
import
utils
from
.
import
utils
from
.exceptions
import
StopThreadPoolExecutor
data_queue
=
queue
.
Queue
()
data_queue
=
queue
.
Queue
()
...
@@ -27,6 +28,10 @@ class WorkerThread(threading.Thread):
...
@@ -27,6 +28,10 @@ class WorkerThread(threading.Thread):
args
=
record
[
1
:]
args
=
record
[
1
:]
try
:
try
:
target
(
*
args
)
target
(
*
args
)
except
StopThreadPoolExecutor
:
utils
.
print_info
()
utils
.
print_status
(
"Waiting for already scheduled jobs to finish..."
)
data_queue
.
queue
.
clear
()
finally
:
finally
:
data_queue
.
task_done
()
data_queue
.
task_done
()
...
@@ -57,10 +62,10 @@ class ThreadPoolExecutor(object):
...
@@ -57,10 +62,10 @@ class ThreadPoolExecutor(object):
utils
.
print_info
()
utils
.
print_info
()
utils
.
print_status
(
"Waiting for already scheduled jobs to finish..."
)
utils
.
print_status
(
"Waiting for already scheduled jobs to finish..."
)
data_queue
.
queue
.
clear
()
data_queue
.
queue
.
clear
()
finally
:
for
worker
in
self
.
workers
:
for
worker
in
self
.
workers
:
worker
.
join
()
worker
.
join
()
else
:
data_queue
.
unfinished_tasks
=
0
data_queue
.
join
()
utils
.
print_status
(
'Elapsed time: '
,
time
.
time
()
-
start
,
'seconds'
)
utils
.
print_status
(
'Elapsed time: '
,
time
.
time
()
-
start
,
'seconds'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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