mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
This may fix #1080
This commit is contained in:
@@ -61,6 +61,9 @@ local function open_channel(t, key)
|
|||||||
skynet.wakeup(co)
|
skynet.wakeup(co)
|
||||||
end
|
end
|
||||||
assert(succ, err)
|
assert(succ, err)
|
||||||
|
if node_address[key] ~= address then
|
||||||
|
return open_channel(t,key)
|
||||||
|
end
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -76,6 +79,7 @@ local function loadconfig(tmp)
|
|||||||
assert(load(source, "@"..config_name, "t", tmp))()
|
assert(load(source, "@"..config_name, "t", tmp))()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local reload = {}
|
||||||
for name,address in pairs(tmp) do
|
for name,address in pairs(tmp) do
|
||||||
if name:sub(1,2) == "__" then
|
if name:sub(1,2) == "__" then
|
||||||
name = name:sub(3)
|
name = name:sub(3)
|
||||||
@@ -87,6 +91,7 @@ local function loadconfig(tmp)
|
|||||||
-- address changed
|
-- address changed
|
||||||
if rawget(node_channel, name) then
|
if rawget(node_channel, name) then
|
||||||
node_channel[name] = nil -- reset connection
|
node_channel[name] = nil -- reset connection
|
||||||
|
table.insert(reload, name)
|
||||||
end
|
end
|
||||||
node_address[name] = address
|
node_address[name] = address
|
||||||
end
|
end
|
||||||
@@ -105,6 +110,10 @@ local function loadconfig(tmp)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for _, name in ipairs(reload) do
|
||||||
|
-- open_channel would block
|
||||||
|
skynet.fork(open_channel, node_channel, name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function command.reload(source, config)
|
function command.reload(source, config)
|
||||||
|
|||||||
Reference in New Issue
Block a user