mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-02 06:22:24 +00:00
util/eventbus: don't allow publishers to skip events while debugging
If any debugging hook might see an event, Publisher.ShouldPublish should tell its caller to publish even if there are no ordinary subscribers. Updates #15160 Signed-off-by: David Anderson <dave@tailscale.com>
This commit is contained in:
parent
853abf8661
commit
e71e95b841
@ -173,6 +173,10 @@ func (b *Bus) dest(t reflect.Type) []*subscribeState {
|
||||
}
|
||||
|
||||
func (b *Bus) shouldPublish(t reflect.Type) bool {
|
||||
if b.routeDebug.active() {
|
||||
return true
|
||||
}
|
||||
|
||||
b.topicsMu.Lock()
|
||||
defer b.topicsMu.Unlock()
|
||||
return len(b.topics[t]) > 0
|
||||
|
@ -93,7 +93,7 @@ func (c *Client) publish() chan<- PublishedEvent {
|
||||
}
|
||||
|
||||
func (c *Client) shouldPublish(t reflect.Type) bool {
|
||||
return c.bus.shouldPublish(t)
|
||||
return c.publishDebug.active() || c.bus.shouldPublish(t)
|
||||
}
|
||||
|
||||
// Subscribe requests delivery of events of type T through the given
|
||||
|
Loading…
x
Reference in New Issue
Block a user