Skip to content

Commit

Permalink
server: openSession instead set nil when changeUser (#33894) (#34427)
Browse files Browse the repository at this point in the history
close #33892
  • Loading branch information
ti-srebot authored May 7, 2022
1 parent f604940 commit be48447
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,12 @@ func (cc *clientConn) handleChangeUser(ctx context.Context, data []byte) error {
if err := cc.ctx.Close(); err != nil {
logutil.Logger(ctx).Debug("close old context failed", zap.Error(err))
}
cc.ctx = nil
// session was closed by `ctx.Close` and should `openSession` explicitly to renew session.
// `openSession` won't run again in `openSessionAndDoAuth` because ctx is not nil.
err := cc.openSession()
if err != nil {
return err
}
if err := cc.openSessionAndDoAuth(pass, ""); err != nil {
return err
}
Expand Down

0 comments on commit be48447

Please sign in to comment.