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