updated fserv to fit the new (and next) service system
This commit is contained in:
parent
3fed8a5985
commit
3266c66fc4
@ -3,7 +3,8 @@ local serial = require "serialization"
|
|||||||
|
|
||||||
local cfg = {["path"]="/boot/srv/frequest",["port"]=70}
|
local cfg = {["path"]="/boot/srv/frequest",["port"]=70}
|
||||||
|
|
||||||
f=io.open("/boot/cfg/fserv.cfg","rb")
|
local function loadConfig(cfgpath)
|
||||||
|
local f=io.open(cfgpath or "/boot/cfg/fserv.cfg","rb")
|
||||||
if f then
|
if f then
|
||||||
local ncfg = serial.unserialize(f:read("*a"))
|
local ncfg = serial.unserialize(f:read("*a"))
|
||||||
f:close()
|
f:close()
|
||||||
@ -11,6 +12,7 @@ if f then
|
|||||||
cfg[k] = v
|
cfg[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function fileHandler(socket,rtype,path)
|
local function fileHandler(socket,rtype,path)
|
||||||
syslog(string.format("[%s:%d] %s %s",socket.addr,socket.port,rtype,path),syslog.info,"fserv")
|
syslog(string.format("[%s:%d] %s %s",socket.addr,socket.port,rtype,path),syslog.info,"fserv")
|
||||||
@ -90,6 +92,15 @@ local function socketHandler(socket)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fileServer()
|
||||||
while true do
|
while true do
|
||||||
os.spawn(socketHandler(minitel.listen(70)),"fserv worker process")
|
os.spawn(socketHandler(minitel.listen(70)),"fserv worker process")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function start(cfgpath)
|
||||||
|
loadConfig(cfgpath)
|
||||||
|
return os.spawn(fileServer,"fserv")
|
||||||
|
end
|
||||||
|
|
||||||
|
return {start=start}
|
||||||
|
Loading…
Reference in New Issue
Block a user