diff options
Diffstat (limited to 'main.lua')
| -rw-r--r-- | main.lua | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -46,13 +46,19 @@ function Wilson.make(cls, conf) return self end --- find bus containing given channel +function Wilson.add_channels_for(self, pylon) + if not pylon.add_channel then return end + for busname, bus in pairs(self.busses) do + for _, channel in ipairs(bus) do + if channel.pylon == pylon then + pylon:add_channel(channel) +end end end end + function Wilson._find_bus(self, channel) for name, bus in pairs(self.busses) do for _, q in ipairs(bus) do if q == channel then return bus end end end - self.log:warn("unfound bus for",channel) -end + self.log:warn("unfound bus for",channel) end function Wilson.deliver(self, message) local bus = self:_find_bus(assert(message.channel)) if bus then @@ -61,10 +67,7 @@ function Wilson.deliver(self, message) if message.channel ~= dest_channel then self.log:debug(message.channel, "-->", dest_channel, message) dest_channel.pylon:post(dest_channel, message) - end - end - end -end +end end end end function Wilson.run(self) for pylonname, pylon in pairs(self.pylons) do self.cq:wrap(pylon.run, pylon) |
