Fix random iperf failures (#445)

This commit is contained in:
Tim Wilkinson 2022-07-21 07:50:28 -07:00 committed by GitHub
parent 02ec015d90
commit 43fe20f2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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=&lt;ServerName&gt;&amp;protocol=&lt;udp|tcp&gt;]</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=&lt;ServerName&gt;&amp;protocol=&lt;udp|tcp&gt;]</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