cluster.open support cluster name

This commit is contained in:
Cloud Wu
2014-06-19 16:25:50 +08:00
parent ad9898a209
commit d0468a39f4
4 changed files with 13 additions and 3 deletions

View File

@@ -32,7 +32,12 @@ local node_channel = setmetatable({}, { __index = open_channel })
function command.listen(source, addr, port)
local gate = skynet.newservice("gate")
skynet.call(gate, "lua", "open", { address = addr, port = port })
if port == nil then
local host, port = string.match(node_address[addr], "([^:]+):(.*)$")
skynet.call(gate, "lua", "open", { address = host, port = port })
else
skynet.call(gate, "lua", "open", { address = addr, port = port })
end
skynet.ret(skynet.pack(nil))
end