mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
simplify a loop
This commit is contained in:
@@ -106,21 +106,13 @@ local function sendPacketsUDP(data, host, port, timeout, cnt, multiple)
|
|||||||
|
|
||||||
local response
|
local response
|
||||||
|
|
||||||
if ( multiple ) then
|
repeat
|
||||||
while(true) do
|
|
||||||
status, response = socket:receive()
|
|
||||||
if( not(status) ) then break end
|
|
||||||
|
|
||||||
local status, _, _, ip, _ = socket:get_info()
|
|
||||||
table.insert(responses, { data = response, peer = ip } )
|
|
||||||
end
|
|
||||||
else
|
|
||||||
status, response = socket:receive()
|
status, response = socket:receive()
|
||||||
if ( status ) then
|
if( not(status) ) then break end
|
||||||
local status, _, _, ip, _ = socket:get_info()
|
|
||||||
table.insert(responses, { data = response, peer = ip } )
|
local status, _, _, ip, _ = socket:get_info()
|
||||||
end
|
table.insert(responses, { data = response, peer = ip } )
|
||||||
end
|
until not multiple
|
||||||
|
|
||||||
if (#responses>0) then
|
if (#responses>0) then
|
||||||
socket:close()
|
socket:close()
|
||||||
|
|||||||
Reference in New Issue
Block a user