mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-06 21:01:56 +00:00
util/eventbus: add debugger methods to list pub/sub types
This lets debug tools list the types that clients are wielding, so that they can build a dataflow graph and other debugging views. Updates #15160 Signed-off-by: David Anderson <dave@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
e71e95b841
commit
346a35f612
@@ -120,6 +120,20 @@ func (s *subscribeState) snapshotQueue() []DeliveredEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *subscribeState) subscribeTypes() []reflect.Type {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
s.outputsMu.Lock()
|
||||
defer s.outputsMu.Unlock()
|
||||
ret := make([]reflect.Type, 0, len(s.outputs))
|
||||
for t := range s.outputs {
|
||||
ret = append(ret, t)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (s *subscribeState) addSubscriber(t reflect.Type, sub subscriber) {
|
||||
s.outputsMu.Lock()
|
||||
defer s.outputsMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user