Nmap Development mailing list archives

Re: [nmap-svn] r25684 - nmap-exp/calderon/nselib


From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 9 Aug 2011 23:46:53 -0400

Hi Paulino,

On Tue, Aug 9, 2011 at 3:33 AM,  <commit-mailer () insecure org> wrote:
Author: paulino
Date: Tue Aug  9 00:33:52 2011
New Revision: 25684

Log:
improvements

Modified:
  nmap-exp/calderon/nselib/httpspider.lua

Modified: nmap-exp/calderon/nselib/httpspider.lua
[...]
+local function add_visited_uri(uri, page_obj)
+  VISITED_MUTEX "lock"
+  if nmap.registry[HTTPSPIDER_DATAKEY]["visited"][uri] == nil then
+    nmap.registry[HTTPSPIDER_DATAKEY]["visited"][uri] = page_obj
  end
-  VL_MUTEX "done"
+  VISITED_MUTEX "done"
 end

There's no need for this mutex here. Scripts (Lua threads --
coroutines) do not yield asynchronously; that is, they do not yield at
arbitrary locations in the code. Mutexes in NSE are used to serialize
access to some resource *when the script may yield between the lock
and unlock*. Scripts only yield *explicitly* through calls to socket
functions (e.g. socket:connect(...) or nmap.sleep(...)) or through the
concurrency control mechanisms (mutexes and condition variables).

Take a look at [1]. If something is unclear please let us (nmap-dev)
know so we can improve it.

[1] http://nmap.org/book/nse-parallelism.html#nse-parallelism-mutex

-- 
- Patrick Donnelly
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Current thread: