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

Function dispatchWithTimeout

internal/bridge/transfer_e2e_test.go:148–164  ·  view source on GitHub ↗

dispatchWithTimeout runs registry.Dispatch in a goroutine and waits for completion.

(t *testing.T, b *Bridge, sessionID string, taskID uint32, spite *implantpb.Spite, timeout time.Duration)

Source from the content-addressed store, hash-verified

146
147// dispatchWithTimeout runs registry.Dispatch in a goroutine and waits for completion.
148func dispatchWithTimeout(t *testing.T, b *Bridge, sessionID string, taskID uint32, spite *implantpb.Spite, timeout time.Duration) {
149 t.Helper()
150 ctx := b.moduleContext()
151 done := make(chan bool, 1)
152 go func() {
153 ok := b.registry.Dispatch(ctx, sessionID, taskID, spite)
154 done <- ok
155 }()
156 select {
157 case ok := <-done:
158 if !ok {
159 t.Errorf("dispatch returned false for spite=%s", spite.Name)
160 }
161 case <-time.After(timeout):
162 t.Fatalf("dispatch timed out after %v for spite=%s", timeout, spite.Name)
163 }
164}
165
166// ===================================================================
167// E2E: Direct Upload (small text file via Write tool)

Calls 2

moduleContextMethod · 0.80
DispatchMethod · 0.80

Tested by

no test coverage detected