mirror of https://github.com/aredn/aredn.git
Fix random iperf failures (#445)
This commit is contained in:
parent
02ec015d90
commit
43fe20f2bd
|
@ -37,6 +37,9 @@
|
||||||
require("uci")
|
require("uci")
|
||||||
require("luci.sys")
|
require("luci.sys")
|
||||||
require("nixio")
|
require("nixio")
|
||||||
|
local info = require("aredn.info")
|
||||||
|
|
||||||
|
local node = info.get_nvram("node")
|
||||||
|
|
||||||
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,7 +54,7 @@ if uci.cursor():get("aredn", "@iperf[0]", "enable") == "0" then
|
||||||
elseif not server then
|
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 -B " .. node)
|
||||||
for _ = 1,5
|
for _ = 1,5
|
||||||
do
|
do
|
||||||
if io.popen("netstat -ln | grep 0.0.0.0:5201"):read("*a") ~= "" then
|
if io.popen("netstat -ln | grep 0.0.0.0:5201"):read("*a") ~= "" then
|
||||||
|
|
Loading…
Reference in New Issue