mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
cluster.open support cluster name
This commit is contained in:
@@ -2,6 +2,7 @@ Dev version
|
|||||||
-----------
|
-----------
|
||||||
* Optimize redis driver `compose_message`.
|
* Optimize redis driver `compose_message`.
|
||||||
* Add module skynet.harbor for monitor harbor connect/disconnect, see test/testharborlink.lua .
|
* Add module skynet.harbor for monitor harbor connect/disconnect, see test/testharborlink.lua .
|
||||||
|
* cluster.open support cluster name.
|
||||||
|
|
||||||
v0.3.1 (2014-6-16)
|
v0.3.1 (2014-6-16)
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ skynet.start(function()
|
|||||||
skynet.newservice("simpledb")
|
skynet.newservice("simpledb")
|
||||||
print(skynet.call("SIMPLEDB", "lua", "SET", "a", "foobar"))
|
print(skynet.call("SIMPLEDB", "lua", "SET", "a", "foobar"))
|
||||||
print(skynet.call("SIMPLEDB", "lua", "GET", "a"))
|
print(skynet.call("SIMPLEDB", "lua", "GET", "a"))
|
||||||
cluster.open(2528)
|
cluster.open "db"
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ function cluster.call(node, address, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function cluster.open(port)
|
function cluster.open(port)
|
||||||
skynet.call(clusterd, "lua", "listen", "0.0.0.0", port)
|
if type(port) == "string" then
|
||||||
|
skynet.call(clusterd, "lua", "listen", port)
|
||||||
|
else
|
||||||
|
skynet.call(clusterd, "lua", "listen", "0.0.0.0", port)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
skynet.init(function()
|
skynet.init(function()
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ local node_channel = setmetatable({}, { __index = open_channel })
|
|||||||
|
|
||||||
function command.listen(source, addr, port)
|
function command.listen(source, addr, port)
|
||||||
local gate = skynet.newservice("gate")
|
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))
|
skynet.ret(skynet.pack(nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user