|
|
@@ -504,12 +504,12 @@ local function co_wan()
|
|
|
local link_last, ip_last = nil, nil
|
|
|
|
|
|
local f = io.open("/sys/class/net/" .. cfg.wan_device .. "/carrier", "r")
|
|
|
- if f then link_last = (f:read("*a") or "":find("^1") == 1; f:close() end
|
|
|
+ if f then local content = f:read("*a") or ""; link_last = content:find("^1") == 1; f:close() end
|
|
|
|
|
|
while true do
|
|
|
-- Link
|
|
|
f = io.open("/sys/class/net/" .. cfg.wan_device .. "/carrier", "r")
|
|
|
- local link_now = f and ((f:read("*a") or ""):find("^1") == 1) or false
|
|
|
+ local content = f and f:read("*a") or ""; local link_now = content:find("^1") == 1 or false
|
|
|
if f then f:close() end
|
|
|
|
|
|
if link_now ~= link_last then
|