mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #7005 from heyitsanthony/fix-pprof
embed: deep copy user handlers
This commit is contained in:
commit
a9f72ee0d4
@ -286,7 +286,9 @@ func startClientListeners(cfg *Config) (sctxs map[string]*serveCtx, err error) {
|
||||
plog.Info("stopping listening for client requests on ", u.Host)
|
||||
}
|
||||
}()
|
||||
sctx.userHandlers = cfg.UserHandlers
|
||||
for k := range cfg.UserHandlers {
|
||||
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
||||
}
|
||||
if cfg.EnablePprof {
|
||||
sctx.registerPprof()
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ type serveCtx struct {
|
||||
|
||||
func newServeCtx() *serveCtx {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
return &serveCtx{ctx: ctx, cancel: cancel}
|
||||
return &serveCtx{ctx: ctx, cancel: cancel, userHandlers: make(map[string]http.Handler)}
|
||||
}
|
||||
|
||||
// serve accepts incoming connections on the listener l,
|
||||
|
Loading…
x
Reference in New Issue
Block a user