| 123 | } |
| 124 | |
| 125 | func (w *Watcher) refreshAuthState(force bool) { |
| 126 | w.clientsMutex.RLock() |
| 127 | cfg := w.config |
| 128 | authDir := w.authDir |
| 129 | parser := w.pluginAuthParser |
| 130 | w.clientsMutex.RUnlock() |
| 131 | auths := snapshotCoreAuthsFunc(cfg, authDir, parser) |
| 132 | w.clientsMutex.Lock() |
| 133 | if len(w.runtimeAuths) > 0 { |
| 134 | for _, a := range w.runtimeAuths { |
| 135 | if a != nil { |
| 136 | auths = append(auths, a.Clone()) |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | updates := w.prepareAuthUpdatesLocked(auths, force) |
| 141 | w.clientsMutex.Unlock() |
| 142 | w.dispatchAuthUpdates(updates) |
| 143 | } |
| 144 | |
| 145 | func (w *Watcher) prepareAuthUpdatesLocked(auths []*coreauth.Auth, force bool) []AuthUpdate { |
| 146 | newState := make(map[string]*coreauth.Auth, len(auths)) |