mirror of
https://github.com/nmap/nmap.git
synced 2025-12-11 10:19:03 +00:00
Previously, process_mainloop() assumed that there can occur only one event for l_nsock_loop(). This is obviously wrong. This caused that some lua threads wakeups (when multiple events happend for one nsock_loop) were delayed. They were handled but way after real events happened. This patch changes the handing of events. Now we execute every lua thread which is in running_scripts(). I hope that every thread will be scheduled in nsock and removed from running_scripts and added to waiting_scripts.
This commit is contained in:
@@ -286,9 +286,7 @@ int process_mainloop(lua_State* l) {
|
||||
}
|
||||
|
||||
|
||||
if(running_scripts.begin() == running_scripts.end())
|
||||
continue;
|
||||
|
||||
while(running_scripts.begin() != running_scripts.end()){
|
||||
current = *(running_scripts.begin());
|
||||
|
||||
if (current.rr->host->timedOut(&now))
|
||||
@@ -335,6 +333,7 @@ int process_mainloop(lua_State* l) {
|
||||
)
|
||||
SCRIPT_ENGINE_TRY(process_finalize(l, current.registry_idx));
|
||||
}
|
||||
} // while
|
||||
}
|
||||
|
||||
progress.endTask(NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user