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
6637aee804
commit
073c530989
@ -685,17 +685,17 @@ func configureClientListeners(cfg *Config) (sctxs map[string]*serveCtx, err erro
|
|||||||
sctx.l = transport.LimitListener(sctx.l, int(fdLimit-reservedInternalFDNum))
|
sctx.l = transport.LimitListener(sctx.l, int(fdLimit-reservedInternalFDNum))
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func(addr string) {
|
defer func(sctx *serveCtx) {
|
||||||
if err == nil || sctx.l == nil {
|
if err == nil || sctx.l == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sctx.l.Close()
|
sctx.l.Close()
|
||||||
cfg.logger.Warn(
|
cfg.logger.Warn(
|
||||||
"closing peer listener",
|
"closing peer listener",
|
||||||
zap.String("address", addr),
|
zap.String("address", sctx.addr),
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
)
|
)
|
||||||
}(sctx.addr)
|
}(sctx)
|
||||||
for k := range cfg.UserHandlers {
|
for k := range cfg.UserHandlers {
|
||||||
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user