mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
multicast dispatch map should be weak
This commit is contained in:
@@ -3,17 +3,12 @@ local mc = require "multicast.c"
|
|||||||
|
|
||||||
local multicastd
|
local multicastd
|
||||||
local multicast = {}
|
local multicast = {}
|
||||||
local dispatch = {}
|
local dispatch = setmetatable({} , {__mode = "kv" })
|
||||||
|
|
||||||
local chan = {}
|
local chan = {}
|
||||||
local chan_meta = {
|
local chan_meta = {
|
||||||
__index = chan,
|
__index = chan,
|
||||||
__gc = function(self)
|
__gc = unsubscribe,
|
||||||
self:unsubscribe()
|
|
||||||
local c = self.channel
|
|
||||||
self.channel = nil
|
|
||||||
dispatch[c] = nil
|
|
||||||
end,
|
|
||||||
__tostring = function (self)
|
__tostring = function (self)
|
||||||
return string.format("[Multicast:%x]",self.channel)
|
return string.format("[Multicast:%x]",self.channel)
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user