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

Method Fail

internal/bridge/taskmanager.go:219–234  ·  view source on GitHub ↗

Fail marks a task as failed with a reason and closes its result channel.

(sessionID string, taskID uint32, reason string)

Source from the content-addressed store, hash-verified

217
218// Fail marks a task as failed with a reason and closes its result channel.
219func (tm *TaskManager) Fail(sessionID string, taskID uint32, reason string) {
220 task := tm.Get(sessionID, taskID)
221 if task == nil {
222 return
223 }
224 task.mu.Lock()
225 defer task.mu.Unlock()
226
227 if task.State == TaskCompleted || task.State == TaskFailed {
228 return // already terminal
229 }
230 task.State = TaskFailed
231 task.Error = reason
232 task.UpdatedAt = time.Now()
233 close(task.resultCh)
234}
235
236// StartSessionListener ensures a single subscriber exists for the given session.
237// The subscriber fans out incoming results to per-task channels based on TaskID.

Callers 15

TestTask_FailStateFunction · 0.95
HandleMethod · 0.80
handleDirectUploadMethod · 0.80
executeChunksMethod · 0.80
acquireShellSessionFunction · 0.80
enqueueAndAwaitFunction · 0.80
enqueueToolActionFunction · 0.80
HandleMethod · 0.80
handleDirectDownloadMethod · 0.80
probeAndDownloadMethod · 0.80
waitForReadResultMethod · 0.80

Calls 1

GetMethod · 0.95

Tested by 2

TestTask_FailStateFunction · 0.76