mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
cluster.open添加maxclient参数 (#1705)
This commit is contained in:
@@ -75,11 +75,11 @@ function cluster.send(node, address, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cluster.open(port)
|
function cluster.open(port, maxclient)
|
||||||
if type(port) == "string" then
|
if type(port) == "string" then
|
||||||
return skynet.call(clusterd, "lua", "listen", port)
|
return skynet.call(clusterd, "lua", "listen", port, nil, maxclient)
|
||||||
else
|
else
|
||||||
return skynet.call(clusterd, "lua", "listen", "0.0.0.0", port)
|
return skynet.call(clusterd, "lua", "listen", "0.0.0.0", port, maxclient)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -142,17 +142,17 @@ function command.reload(source, config)
|
|||||||
skynet.ret(skynet.pack(nil))
|
skynet.ret(skynet.pack(nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
function command.listen(source, addr, port)
|
function command.listen(source, addr, port, maxclient)
|
||||||
local gate = skynet.newservice("gate")
|
local gate = skynet.newservice("gate")
|
||||||
if port == nil then
|
if port == nil then
|
||||||
local address = assert(node_address[addr], addr .. " is down")
|
local address = assert(node_address[addr], addr .. " is down")
|
||||||
addr, port = string.match(address, "(.+):([^:]+)$")
|
addr, port = string.match(address, "(.+):([^:]+)$")
|
||||||
port = tonumber(port)
|
port = tonumber(port)
|
||||||
assert(port ~= 0)
|
assert(port ~= 0)
|
||||||
skynet.call(gate, "lua", "open", { address = addr, port = port })
|
skynet.call(gate, "lua", "open", { address = addr, port = port, maxclient = maxclient })
|
||||||
skynet.ret(skynet.pack(addr, port))
|
skynet.ret(skynet.pack(addr, port))
|
||||||
else
|
else
|
||||||
local realaddr, realport = skynet.call(gate, "lua", "open", { address = addr, port = port })
|
local realaddr, realport = skynet.call(gate, "lua", "open", { address = addr, port = port, maxclient = maxclient })
|
||||||
skynet.ret(skynet.pack(realaddr, realport))
|
skynet.ret(skynet.pack(realaddr, realport))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user