Skip to content

Commit

Permalink
bugfix: delete local channel
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Aug 2, 2014
1 parent 11c5289 commit b49fc29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions service/multicastd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function command.DEL(source, c)
channel[c] = nil
channel_n[c] = nil
channel_remote[c] = nil
for node in pairs(remote) do
skynet.send(node_address[node], "lua", "DELR", c)
if remote then
for node in pairs(remote) do
skynet.send(node_address[node], "lua", "DELR", c)
end
end
return NORET
end
Expand Down
6 changes: 5 additions & 1 deletion test/testmulticast2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ local mc = require "multicast"

skynet.start(function()
print("remote start")
skynet.monitor("simplemonitor", true)
local console = skynet.newservice("console")
local channel = dc.get "MCCHANNEL"
if channel then
print("remote channel", channel)
else
print("create local channel")
end
for i=1,10 do
local sub = skynet.newservice("testmulticast", "sub")
skynet.call(sub, "lua", "init", channel)
Expand Down

0 comments on commit b49fc29

Please sign in to comment.