mirror of
https://github.com/nmap/nmap.git
synced 2025-12-11 10:19:03 +00:00
Don't hang waiting for threads that don't exist if they errored out
This commit is contained in:
@@ -807,7 +807,7 @@ Engine = {
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Updtae tick and add this thread to the batch
|
-- Update tick and add this thread to the batch
|
||||||
self.tick = self.tick + 1
|
self.tick = self.tick + 1
|
||||||
|
|
||||||
if not (self.batch:isFull()) and not thread_data.in_batch then
|
if not (self.batch:isFull()) and not thread_data.in_batch then
|
||||||
@@ -1218,14 +1218,17 @@ Engine = {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local threads = self:threadCount()
|
||||||
stdnse.debug2("Status: #threads = %d, #retry_accounts = %d, initial_accounts_exhausted = %s, waiting = %d",
|
stdnse.debug2("Status: #threads = %d, #retry_accounts = %d, initial_accounts_exhausted = %s, waiting = %d",
|
||||||
self:threadCount(), #self.retry_accounts, tostring(self.initial_accounts_exhausted),
|
threads, #self.retry_accounts, tostring(self.initial_accounts_exhausted),
|
||||||
nmap.socket.get_stats().connect_waiting)
|
nmap.socket.get_stats().connect_waiting)
|
||||||
|
|
||||||
-- wake up other threads
|
if threads > 0 then
|
||||||
-- wait for all threads to finish running
|
-- wake up other threads
|
||||||
condvar "broadcast"
|
-- wait for all threads to finish running
|
||||||
condvar "wait"
|
condvar "broadcast"
|
||||||
|
condvar "wait"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user