Explorar o código

Fix: remove luv.new_task, fork ubus listen to background

luv.new_task not available in all luv versions.
Use shell fork instead to run ubus listen in background.
Gogs hai 2 meses
pai
achega
7bd265d72e
Modificáronse 1 ficheiros con 15 adicións e 4 borrados
  1. 15 4
      usr/sbin/client2server-luv.lua

+ 15 - 4
usr/sbin/client2server-luv.lua

@@ -316,14 +316,25 @@ local function start_ubus_listen()
         log_info("ubus listen ended")
     end
     
-    -- Run ubus listen in background thread
-    luv.new_task(function()
-        ubus_listen_loop()
-    end)
+    -- Run ubus listen in background (forked process)
+    -- Use shell fork to run in background
+    os.execute("ubus listen dhcp ipv4leases network.interface.* hostapd.* 2>&1 &>/dev/null & true")
     
     return true
 end
 
+-- Alternative: simple fork without luv.new_task
+local function start_ubus_fork()
+    log_info("Starting ubus listen in background...")
+    
+    -- Fork ubus listen to background
+    local pid = io.popen("nohup ubus listen dhcp ipv4leases network.interface.* hostapd.* 2>&1 &", "w")
+    if pid then pid:close() end
+    
+    log_info("ubus listen forked to background")
+    return true
+end
+
 -- ============================================================================
 -- MAIN
 -- ============================================================================