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

Method Apply

sdk/cliproxy/pprof_server.go:44–79  ·  view source on GitHub ↗
(cfg *config.Config)

Source from the content-addressed store, hash-verified

42}
43
44func (p *pprofServer) Apply(cfg *config.Config) {
45 if p == nil || cfg == nil {
46 return
47 }
48 addr := strings.TrimSpace(cfg.Pprof.Addr)
49 if addr == "" {
50 addr = config.DefaultPprofAddr
51 }
52 enabled := cfg.Pprof.Enable
53
54 p.mu.Lock()
55 currentServer := p.server
56 currentAddr := p.addr
57 p.addr = addr
58 p.enabled = enabled
59 if !enabled {
60 p.server = nil
61 p.mu.Unlock()
62 if currentServer != nil {
63 p.stopServer(currentServer, currentAddr, "disabled")
64 }
65 return
66 }
67 if currentServer != nil && currentAddr == addr {
68 p.mu.Unlock()
69 return
70 }
71 p.server = nil
72 p.mu.Unlock()
73
74 if currentServer != nil {
75 p.stopServer(currentServer, currentAddr, "restarted")
76 }
77
78 p.startServer(addr)
79}
80
81func (p *pprofServer) Shutdown(ctx context.Context) error {
82 if p == nil {

Callers

nothing calls this directly

Calls 2

stopServerMethod · 0.95
startServerMethod · 0.95

Tested by

no test coverage detected