mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
Pre-prime the first list of CONCURRENCY_LIMIT threads, and bail out
early if there are none to be run. This avoids printing ScanProgressMeter messages.
This commit is contained in:
parent
1392faf5d4
commit
9857411032
1 changed files with 16 additions and 1 deletions
17
nse_main.lua
17
nse_main.lua
|
|
@ -634,7 +634,6 @@ local function run (threads_iter, scantype)
|
|||
local current; -- The currently running Thread.
|
||||
local total = 0; -- Number of threads, for record keeping.
|
||||
local timeouts = {}; -- A list to save and to track scripts timeout.
|
||||
local progress = cnse.scan_progress_meter(NAME);
|
||||
local num_threads = 0; -- Number of script instances currently running.
|
||||
|
||||
-- Map of yielded threads to the base Thread
|
||||
|
|
@ -708,6 +707,22 @@ local function run (threads_iter, scantype)
|
|||
return current.co;
|
||||
end);
|
||||
|
||||
while threads_iter and num_threads < CONCURRENCY_LIMIT do
|
||||
local thread = threads_iter()
|
||||
if not thread then
|
||||
threads_iter = nil;
|
||||
break;
|
||||
end
|
||||
all[thread.co], running[thread.co], total = thread, thread, total+1;
|
||||
num_threads = num_threads + 1;
|
||||
thread:start(timeouts);
|
||||
end
|
||||
if num_threads == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local progress = cnse.scan_progress_meter(NAME);
|
||||
|
||||
-- Loop while any thread is running or waiting.
|
||||
while next(running) or next(waiting) or threads_iter do
|
||||
-- Start as many new threads as possible.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue