mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
add cluster.proxy and cluster.ncall
This commit is contained in:
@@ -93,6 +93,7 @@ local function monitor_master(master_fd)
|
||||
local fd = slaves[id_name]
|
||||
slaves[id_name] = false
|
||||
if fd then
|
||||
monitor_clear(id_name)
|
||||
socket.close(fd)
|
||||
end
|
||||
end
|
||||
@@ -143,14 +144,14 @@ local function monitor_harbor(master_fd)
|
||||
return function(session, source, command)
|
||||
local t = string.sub(command, 1, 1)
|
||||
local arg = string.sub(command, 3)
|
||||
if t == "Q" then
|
||||
if t == 'Q' then
|
||||
-- query name
|
||||
if globalname[arg] then
|
||||
skynet.redirect(harbor_service, globalname[arg], "harbor", 0, "N " .. arg)
|
||||
else
|
||||
socket.write(master_fd, pack_package("Q", arg))
|
||||
end
|
||||
elseif t == "D" then
|
||||
elseif t == 'D' then
|
||||
-- harbor down
|
||||
local id = tonumber(arg)
|
||||
if slaves[id] then
|
||||
@@ -194,6 +195,10 @@ function harbor.CONNECT(fd, id)
|
||||
end
|
||||
|
||||
function harbor.QUERYNAME(fd, name)
|
||||
if name:byte() == 46 then -- "." , local name
|
||||
skynet.ret(skynet.pack(skynet.localname(name)))
|
||||
return
|
||||
end
|
||||
local result = globalname[name]
|
||||
if result then
|
||||
skynet.ret(skynet.pack(result))
|
||||
|
||||
Reference in New Issue
Block a user