1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- local service = require "skynet.service"
- local skynet = require "skynet.manager" -- import skynet.launch, ...
- skynet.start(function()
- local standalone = skynet.getenv "standalone"
- local launcher = assert(skynet.launch("snlua","launcher"))
- skynet.name(".launcher", launcher)
- local harbor_id = tonumber(skynet.getenv "harbor" or 0)
- if harbor_id == 0 then
- assert(standalone == nil)
- standalone = true
- skynet.setenv("standalone", "true")
- local ok, slave = pcall(skynet.newservice, "cdummy")
- if not ok then
- skynet.abort()
- end
- skynet.name(".cslave", slave)
- else
- if standalone then
- if not pcall(skynet.newservice,"cmaster") then
- skynet.abort()
- end
- end
- local ok, slave = pcall(skynet.newservice, "cslave")
- if not ok then
- skynet.abort()
- end
- skynet.name(".cslave", slave)
- end
- if standalone then
- local datacenter = skynet.newservice "datacenterd"
- skynet.name("DATACENTER", datacenter)
- end
- skynet.newservice "service_mgr"
- local enablessl = skynet.getenv "enablessl"
- if enablessl == "true" then
- service.new("ltls_holder", function ()
- local c = require "ltls.init.c"
- c.constructor()
- end)
- end
- pcall(skynet.newservice,skynet.getenv "start" or "main")
- skynet.exit()
- end)
|