mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
This may fix #1080
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user