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

Method EnqueueAction

internal/sessions/manager.go:151–164  ·  view source on GitHub ↗

EnqueueAction adds a pending action to a session's queue. Poison actions are always inserted at the front (highest priority).

(sessionID string, action *PendingAction)

Source from the content-addressed store, hash-verified

149// EnqueueAction adds a pending action to a session's queue.
150// Poison actions are always inserted at the front (highest priority).
151func (m *Manager) EnqueueAction(sessionID string, action *PendingAction) bool {
152 sess := m.Get(sessionID)
153 if sess == nil {
154 return false
155 }
156 sess.mu.Lock()
157 defer sess.mu.Unlock()
158 if action.Type == ActionPoison {
159 sess.pendingActions = append([]*PendingAction{action}, sess.pendingActions...)
160 } else {
161 sess.pendingActions = append(sess.pendingActions, action)
162 }
163 return true
164}
165
166// DequeueAction removes and returns the next pending action.
167// Poison actions have priority: if any exist, the first poison is returned.

Callers 4

enqueueAndAwaitFunction · 0.80
enqueueToolActionFunction · 0.80
HandleMethod · 0.80
PostSessionExecMethod · 0.80

Calls 1

GetMethod · 0.95

Tested by

no test coverage detected