diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 372ee8c1..366b35e4 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -178,7 +178,9 @@ end function skynet.cast(group, typename, ...) local p = proto[typename] - return c.send(".cast", p.id, 0, mc(group, p.pack(...))) + if #group > 0 then + return c.send(".cast", p.id, 0, mc(group, p.pack(...))) + end end skynet.genid = assert(c.genid) diff --git a/skynet-src/skynet_multicast.c b/skynet-src/skynet_multicast.c index 12fd24a6..ba2b74bb 100644 --- a/skynet-src/skynet_multicast.c +++ b/skynet-src/skynet_multicast.c @@ -216,6 +216,8 @@ void skynet_multicast_cast(struct skynet_context * from, struct skynet_multicast_message *msg, const uint32_t *dests, int n) { uint32_t source = skynet_context_handle(from); skynet_multicast_copy(msg, n); + if (n == 0) + return; int i; int release = 0; for (i=0;i