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

Method ShutdownAll

internal/pluginhost/host.go:432–493  ·  view source on GitHub ↗

ShutdownAll removes active plugin capabilities and closes all loaded dynamic libraries.

()

Source from the content-addressed store, hash-verified

430
431// ShutdownAll removes active plugin capabilities and closes all loaded dynamic libraries.
432func (h *Host) ShutdownAll() {
433 if h == nil {
434 return
435 }
436
437 h.applyMu.Lock()
438 defer h.applyMu.Unlock()
439
440 targets := make([]pluginUnloadTarget, 0)
441 h.mu.Lock()
442 for _, lp := range h.loaded {
443 if lp == nil || lp.client == nil {
444 continue
445 }
446 targets = append(targets, pluginUnloadTarget{
447 id: lp.id,
448 name: lp.name,
449 path: lp.path,
450 version: lp.version,
451 client: lp.client,
452 })
453 }
454 for _, retiredPlugins := range h.retired {
455 for _, lp := range retiredPlugins {
456 if lp == nil || lp.client == nil {
457 continue
458 }
459 targets = append(targets, pluginUnloadTarget{
460 id: lp.id,
461 name: lp.name,
462 path: lp.path,
463 version: lp.version,
464 client: lp.client,
465 })
466 }
467 }
468 h.loaded = make(map[string]*loadedPlugin)
469 h.retired = make(map[string][]*loadedPlugin)
470 h.loading = make(map[string]struct{})
471 h.modelClientIDs = make(map[string]struct{})
472 h.executorModelClientIDs = make(map[string]struct{})
473 h.modelProviders = make(map[string]string)
474 h.modelRegistrations = make(map[string]pluginModelRegistration)
475 h.providerModels = make(map[string][]*registryModelInfo)
476 h.executorProviders = make(map[string]struct{})
477 h.commandLineFlags = make(map[string]commandLineFlagRecord)
478 h.commandLineHits = make(map[string]struct{})
479 h.managementRoutes = make(map[string]managementRouteRecord)
480 h.resourceRoutes = make(map[string]resourceRouteRecord)
481 h.pluginFileVersions = make(map[string]string)
482 h.activePluginVersions = make(map[string]string)
483 h.activePluginPaths = make(map[string]string)
484 h.snapshot.Store(emptySnapshot())
485 h.mu.Unlock()
486
487 h.refreshThinkingProviders(nil)
488 h.RegisterFrontendAuthProviders()
489 for _, target := range targets {

Calls 5

emptySnapshotFunction · 0.85
pluginLogFieldsFunction · 0.85
ShutdownMethod · 0.65