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

Method emit

internal/pluginhost/stream_bridge.go:57–76  ·  view source on GitHub ↗
(ctx context.Context, id string, chunk pluginapi.ExecutorStreamChunk)

Source from the content-addressed store, hash-verified

55}
56
57func (b *streamBridge) emit(ctx context.Context, id string, chunk pluginapi.ExecutorStreamChunk) error {
58 if b == nil || id == "" {
59 return fmt.Errorf("stream id is required")
60 }
61 b.mu.Lock()
62 chunks := b.streams[id]
63 b.mu.Unlock()
64 if chunks == nil {
65 return fmt.Errorf("stream %s is not open", id)
66 }
67 if ctx == nil {
68 ctx = context.Background()
69 }
70 select {
71 case <-ctx.Done():
72 return ctx.Err()
73 case chunks <- chunk:
74 return nil
75 }
76}
77
78func (b *streamBridge) close(id string, errorMessage string) {
79 if b == nil || id == "" {

Callers 1

callHostStreamEmitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected