mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
snax service support cluster
This commit is contained in:
@@ -11,6 +11,7 @@ skynet.register_protocol {
|
||||
}
|
||||
|
||||
local forward_map = {
|
||||
[skynet.PTYPE_SNAX] = skynet.PTYPE_SYSTEM,
|
||||
[skynet.PTYPE_LUA] = skynet.PTYPE_SYSTEM,
|
||||
[skynet.PTYPE_RESPONSE] = skynet.PTYPE_RESPONSE, -- don't free response message
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ end
|
||||
|
||||
skynet.start(function()
|
||||
local init = false
|
||||
skynet.dispatch("snax", function ( session , source , id, ...)
|
||||
local function dispatcher( session , source , id, ...)
|
||||
local method = func[id]
|
||||
|
||||
if method[2] == "system" then
|
||||
@@ -84,5 +84,11 @@ skynet.start(function()
|
||||
assert(init, "Init first")
|
||||
timing(method, ...)
|
||||
end
|
||||
end)
|
||||
end
|
||||
skynet.dispatch("snax", dispatcher)
|
||||
|
||||
-- set lua dispatcher
|
||||
function snax.enablecluster()
|
||||
skynet.dispatch("lua", dispatcher)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user