1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 17:09:02 +00:00

New convenience function stdnse.get_timeout

This commit is contained in:
dmiller
2014-09-02 18:23:09 +00:00
parent 2692746c42
commit c615bee688
3 changed files with 40 additions and 10 deletions

View File

@@ -163,12 +163,7 @@ Comm = {
if (not(status)) then
return status, err
end
timeout = timeout or (
-- Use host timeout value * 5 if available
(type(host) == "table" and host.times and host.times.timeout * 5)
or 10 -- default 10 seconds
) * 1000 -- convert to ms
stdnse.debug1("Timeout: %d", timeout)
timeout = timeout or stdnse.get_timeout(host, 10000)
local new_socket = function(...)
local socket = nmap.new_socket(...)
socket:set_timeout(timeout)