Skip to content

Commit

Permalink
webconsole: fix old session make new session closed
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi committed Jul 16, 2020
1 parent 0bfba15 commit 37ee6f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/webconsole/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"math/rand"
"net/url"
"reflect"
"sync"
"time"

Expand Down Expand Up @@ -136,7 +137,11 @@ func (s *SSession) Close() error {
if err := s.ISessionData.Cleanup(); err != nil {
log.Errorf("Clean up command error: %v", err)
}
Manager.Delete(s.Id)
if curS, ok := Manager.Load(s.GetId()); ok {
if reflect.DeepEqual(curS, s) {
Manager.Delete(s.Id)
}
}
return nil
}

Expand Down

0 comments on commit 37ee6f8

Please sign in to comment.