add skynet.harbor.linkmaster

This commit is contained in:
Cloud Wu
2014-09-25 18:16:24 +08:00
parent 885c5b56bb
commit f32f613ac0
3 changed files with 20 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ local queryname = {}
local harbor = {}
local harbor_service
local monitor = {}
local monitor_master_set = {}
local function read_package(fd)
local sz = socket.read(fd, 1)
@@ -99,6 +100,9 @@ local function monitor_master(master_fd)
end
else
skynet.error("Master disconnect")
for _, v in ipairs(monitor_master_set) do
v(true)
end
socket.close(master_fd)
break
end
@@ -183,6 +187,10 @@ function harbor.LINK(fd, id)
end
end
function harbor.LINKMASTER()
table.insert(monitor_master_set, skynet.response())
end
function harbor.CONNECT(fd, id)
if not slaves[id] then
if monitor[id] == nil then