This may fix #1080

This commit is contained in:
Cloud Wu
2019-08-30 10:11:51 +08:00
parent 5025e6887f
commit e485aae55b

View File

@@ -61,6 +61,9 @@ local function open_channel(t, key)
skynet.wakeup(co)
end
assert(succ, err)
if node_address[key] ~= address then
return open_channel(t,key)
end
return c
end
@@ -76,6 +79,7 @@ local function loadconfig(tmp)
assert(load(source, "@"..config_name, "t", tmp))()
end
end
local reload = {}
for name,address in pairs(tmp) do
if name:sub(1,2) == "__" then
name = name:sub(3)
@@ -87,6 +91,7 @@ local function loadconfig(tmp)
-- address changed
if rawget(node_channel, name) then
node_channel[name] = nil -- reset connection
table.insert(reload, name)
end
node_address[name] = address
end
@@ -105,6 +110,10 @@ local function loadconfig(tmp)
end
end
end
for _, name in ipairs(reload) do
-- open_channel would block
skynet.fork(open_channel, node_channel, name)
end
end
function command.reload(source, config)