(queue chan<- AuthUpdate)
| 17 | var snapshotCoreAuthsFunc = snapshotCoreAuths |
| 18 | |
| 19 | func (w *Watcher) setAuthUpdateQueue(queue chan<- AuthUpdate) { |
| 20 | w.clientsMutex.Lock() |
| 21 | defer w.clientsMutex.Unlock() |
| 22 | w.authQueue = queue |
| 23 | if w.dispatchCond == nil { |
| 24 | w.dispatchCond = sync.NewCond(&w.dispatchMu) |
| 25 | } |
| 26 | if w.dispatchCancel != nil { |
| 27 | w.dispatchCancel() |
| 28 | if w.dispatchCond != nil { |
| 29 | w.dispatchMu.Lock() |
| 30 | w.dispatchCond.Broadcast() |
| 31 | w.dispatchMu.Unlock() |
| 32 | } |
| 33 | w.dispatchCancel = nil |
| 34 | } |
| 35 | if queue != nil { |
| 36 | ctx, cancel := context.WithCancel(context.Background()) |
| 37 | w.dispatchCancel = cancel |
| 38 | go w.dispatchLoop(ctx) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func (w *Watcher) dispatchRuntimeAuthUpdate(update AuthUpdate) bool { |
| 43 | if w == nil { |
no test coverage detected