From b49fc291a7e159da52609ed9c735d8b1714f3a8f Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Sat, 2 Aug 2014 18:32:54 +0800 Subject: [PATCH] bugfix: delete local channel --- service/multicastd.lua | 6 ++++-- test/testmulticast2.lua | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/service/multicastd.lua b/service/multicastd.lua index 66e4f1c4..dba56359 100644 --- a/service/multicastd.lua +++ b/service/multicastd.lua @@ -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 diff --git a/test/testmulticast2.lua b/test/testmulticast2.lua index 0f55b77d..ff1342c2 100644 --- a/test/testmulticast2.lua +++ b/test/testmulticast2.lua @@ -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)