mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
lua service init error behavior changed
This commit is contained in:
@@ -601,12 +601,22 @@ local function init_template(start)
|
|||||||
init_all()
|
init_all()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function init_service(start)
|
||||||
|
local ok, err = xpcall(init_template, debug.traceback, start)
|
||||||
|
if not ok then
|
||||||
|
print("init service failed:", err)
|
||||||
|
skynet.send(".launcher","text", "ERROR")
|
||||||
|
skynet.exit()
|
||||||
|
else
|
||||||
|
skynet.send(".launcher","text", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function skynet.start(start_func)
|
function skynet.start(start_func)
|
||||||
c.callback(dispatch_message)
|
c.callback(dispatch_message)
|
||||||
trace_handle = assert(c.stat "trace")
|
trace_handle = assert(c.stat "trace")
|
||||||
skynet.timeout(0, function()
|
skynet.timeout(0, function()
|
||||||
init_template(start_func)
|
init_service(start_func)
|
||||||
skynet.send(".launcher","text", "")
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -616,8 +626,7 @@ function skynet.filter(f ,start_func)
|
|||||||
end)
|
end)
|
||||||
trace_handle = assert(c.stat "trace")
|
trace_handle = assert(c.stat "trace")
|
||||||
skynet.timeout(0, function()
|
skynet.timeout(0, function()
|
||||||
init_template(start_func)
|
init_service(start_func)
|
||||||
skynet.send(".launcher","text", "")
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user