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

Method safePluginCall

internal/pluginhost/host.go:626–643  ·  view source on GitHub ↗
(ctx context.Context, id, method string, fn func() pluginapi.Plugin)

Source from the content-addressed store, hash-verified

624}
625
626func (h *Host) safePluginCall(ctx context.Context, id, method string, fn func() pluginapi.Plugin) (out pluginapi.Plugin, ok bool) {
627 defer func() {
628 if recovered := recover(); recovered != nil {
629 h.fusePlugin(id, method, recovered)
630 out = pluginapi.Plugin{}
631 ok = false
632 }
633 }()
634
635 if ctx != nil {
636 select {
637 case <-ctx.Done():
638 return pluginapi.Plugin{}, false
639 default:
640 }
641 }
642 return fn(), true
643}
644
645func validPlugin(plugin pluginapi.Plugin) bool {
646 if strings.TrimSpace(plugin.Metadata.Name) == "" {

Callers 1

callRegisterMethod · 0.95

Calls 1

fusePluginMethod · 0.95

Tested by

no test coverage detected