webconsole: fix old session make new session closed

This commit is contained in:
Zexi Li
2020-07-16 18:50:29 +08:00
parent e39ce07331
commit 1d2b64d62e
+6 -1
View File
@@ -18,6 +18,7 @@ import (
"fmt"
"math/rand"
"net/url"
"reflect"
"sync"
"time"
@@ -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
}