1
0
mirror of https://github.com/kepler155c/opus synced 2025-11-23 18:44:54 +00:00

transition to kernel

This commit is contained in:
kepler155c@gmail.com
2018-01-14 16:44:43 -05:00
parent 9de9452dd3
commit 30dd2a2b16
7 changed files with 113 additions and 111 deletions

40
sys/apps/netdaemon.lua Normal file
View File

@@ -0,0 +1,40 @@
_G.requireInjector()
local Event = require('event')
local Util = require('util')
local device = _G.device
local fs = _G.fs
local network = _G.network
local os = _G.os
local printError = _G.printError
if not device.wireless_modem then
return
end
print('Net daemon started')
for _,file in pairs(fs.list('sys/network')) do
local fn, msg = Util.run(_ENV, 'sys/network/' .. file)
if not fn then
printError(msg)
end
end
Event.on('device_detach', function()
if not device.wireless_modem then
Event.exitPullEvents()
end
end)
Event.pullEvents()
for _,c in pairs(network) do
c.active = false
os.queueEvent('network_detach', c)
end
os.queueEvent('network_down')
Event.pullEvent('network_down')
Util.clear(network)