mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
cluster.open returns addr, port
This commit is contained in:
@@ -19,8 +19,8 @@ skynet.start(function()
|
||||
print(skynet.call(sdb, "lua", "SET", "b", "foobar2"))
|
||||
print(skynet.call(sdb, "lua", "GET", "a"))
|
||||
print(skynet.call(sdb, "lua", "GET", "b"))
|
||||
cluster.open "db"
|
||||
cluster.open "db2"
|
||||
skynet.error("Open db", cluster.open "db")
|
||||
skynet.error("Open db2", cluster.open "db2")
|
||||
-- unique snax service
|
||||
snax.uniqueservice "pingserver"
|
||||
end)
|
||||
|
||||
@@ -77,9 +77,9 @@ end
|
||||
|
||||
function cluster.open(port)
|
||||
if type(port) == "string" then
|
||||
skynet.call(clusterd, "lua", "listen", port)
|
||||
return skynet.call(clusterd, "lua", "listen", port)
|
||||
else
|
||||
skynet.call(clusterd, "lua", "listen", "0.0.0.0", port)
|
||||
return skynet.call(clusterd, "lua", "listen", "0.0.0.0", port)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -148,8 +148,8 @@ function command.listen(source, addr, port)
|
||||
local address = assert(node_address[addr], addr .. " is down")
|
||||
addr, port = string.match(address, "([^:]+):(.*)$")
|
||||
end
|
||||
skynet.call(gate, "lua", "open", { address = addr, port = port })
|
||||
skynet.ret(skynet.pack(nil))
|
||||
local addr, port = skynet.call(gate, "lua", "open", { address = addr, port = port })
|
||||
skynet.ret(skynet.pack(addr, port))
|
||||
end
|
||||
|
||||
function command.sender(source, node)
|
||||
|
||||
Reference in New Issue
Block a user