snax service support cluster

This commit is contained in:
Cloud Wu
2015-05-20 16:13:11 +08:00
parent 4f93054f3a
commit 7b471ae27d
9 changed files with 31 additions and 5 deletions

View File

@@ -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
}

View File

@@ -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)