mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server: Fix defer function closure escape
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
parent
75675cd464
commit
47d4ff2e36
@ -706,7 +706,7 @@ func configureClientListeners(cfg *Config) (sctxs map[string]*serveCtx, err erro
|
||||
}
|
||||
}
|
||||
|
||||
defer func(addr string) {
|
||||
defer func(sctx *serveCtx) {
|
||||
if err == nil || sctx.l == nil {
|
||||
return
|
||||
}
|
||||
@ -714,13 +714,13 @@ func configureClientListeners(cfg *Config) (sctxs map[string]*serveCtx, err erro
|
||||
if cfg.logger != nil {
|
||||
cfg.logger.Warn(
|
||||
"closing peer listener",
|
||||
zap.String("address", addr),
|
||||
zap.String("address", sctx.addr),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else {
|
||||
plog.Info("stopping listening for client requests on ", addr)
|
||||
plog.Info("stopping listening for client requests on ", sctx.addr)
|
||||
}
|
||||
}(sctx.addr)
|
||||
}(sctx)
|
||||
for k := range cfg.UserHandlers {
|
||||
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user