mirror of https://github.com/aredn/aredn.git
Wait for iperf3 daemon to startup before returning. (#350)
This commit is contained in:
parent
15c83780a5
commit
77c88f2738
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
require("uci")
|
require("uci")
|
||||||
require("luci.sys")
|
require("luci.sys")
|
||||||
|
require("nixio")
|
||||||
|
|
||||||
local q = os.getenv("QUERY_STRING") or ""
|
local q = os.getenv("QUERY_STRING") or ""
|
||||||
local server = q:match("server=([^&]*)")
|
local server = q:match("server=([^&]*)")
|
||||||
|
@ -51,6 +52,13 @@ elseif not server then
|
||||||
print("<html><head></head><body><pre>Provide a server name to run a test between this client and a server [/cgi-bin/iperf?server=<ServerName>&protocol=<udp|tcp>]</pre></body></html>")
|
print("<html><head></head><body><pre>Provide a server name to run a test between this client and a server [/cgi-bin/iperf?server=<ServerName>&protocol=<udp|tcp>]</pre></body></html>")
|
||||||
elseif server == "" then
|
elseif server == "" then
|
||||||
os.execute("killall iperf3; iperf3 -s -D -1")
|
os.execute("killall iperf3; iperf3 -s -D -1")
|
||||||
|
for _ = 1,5
|
||||||
|
do
|
||||||
|
if io.popen("netstat -ln | grep 0.0.0.0:5201"):read("*a") ~= "" then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
nixio.nanosleep(1, 0)
|
||||||
|
end
|
||||||
print("<html><head></head><body><pre>iperf server running (one time)</pre></body></html>")
|
print("<html><head></head><body><pre>iperf server running (one time)</pre></body></html>")
|
||||||
elseif server:match("[^%w-%.]") then
|
elseif server:match("[^%w-%.]") then
|
||||||
print("<html><head></head><body><pre>Illegal server name</pre></body></html>")
|
print("<html><head></head><body><pre>Illegal server name</pre></body></html>")
|
||||||
|
|
Loading…
Reference in New Issue