MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / dispatchRuntimeAuthUpdate

Method dispatchRuntimeAuthUpdate

internal/watcher/dispatcher.go:42–78  ·  view source on GitHub ↗
(update AuthUpdate)

Source from the content-addressed store, hash-verified

40}
41
42func (w *Watcher) dispatchRuntimeAuthUpdate(update AuthUpdate) bool {
43 if w == nil {
44 return false
45 }
46 w.clientsMutex.Lock()
47 if w.runtimeAuths == nil {
48 w.runtimeAuths = make(map[string]*coreauth.Auth)
49 }
50 switch update.Action {
51 case AuthUpdateActionAdd, AuthUpdateActionModify:
52 if update.Auth != nil && update.Auth.ID != "" {
53 clone := update.Auth.Clone()
54 w.runtimeAuths[clone.ID] = clone
55 if w.currentAuths == nil {
56 w.currentAuths = make(map[string]*coreauth.Auth)
57 }
58 w.currentAuths[clone.ID] = clone.Clone()
59 }
60 case AuthUpdateActionDelete:
61 id := update.ID
62 if id == "" && update.Auth != nil {
63 id = update.Auth.ID
64 }
65 if id != "" {
66 delete(w.runtimeAuths, id)
67 if w.currentAuths != nil {
68 delete(w.currentAuths, id)
69 }
70 }
71 }
72 w.clientsMutex.Unlock()
73 if w.getAuthQueue() == nil {
74 return false
75 }
76 w.dispatchAuthUpdates([]AuthUpdate{update})
77 return true
78}
79
80func (w *Watcher) dispatchPersistedAuthUpdate(update AuthUpdate) bool {
81 if w == nil {

Callers 1

Calls 3

getAuthQueueMethod · 0.95
dispatchAuthUpdatesMethod · 0.95
CloneMethod · 0.45

Tested by

no test coverage detected