bug(sessions): Fix authorizeSession race conditions in handleProxy (#2795)
* initial commit
This commit is contained in:
1 parent
1284f8f530
commit
00a73f64d9
3 files changed
+83
-9
No files matched your search
@@ -128,6 +128,7 @@ type sess struct {
|
||||
status pbs.SESSIONSTATUS
|
||||
cert *x509.Certificate
|
||||
sessionId string
|
||||
tofuToken string
|
||||
}
|
||||
|
||||
func newSess(client pbs.SessionServiceClient, resp *pbs.LookupSessionResponse) (*sess, error) {
|
||||
@@ -187,6 +188,12 @@ func (s *sess) ApplyLocalStatus(st pbs.SESSIONSTATUS) {
|
||||
s.status = st
|
||||
}
|
||||
|
||||
func (s *sess) ApplyLocalTofuToken(tt string) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
s.tofuToken = tt
|
||||
}
|
||||
|
||||
func (s *sess) GetLocalConnections() map[string]ConnInfo {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
@@ -207,7 +214,7 @@ func (s *sess) GetLocalConnections() map[string]ConnInfo {
|
||||
func (s *sess) GetTofuToken() string {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
return s.resp.GetTofuToken()
|
||||
return s.tofuToken
|
||||
}
|
||||
|
||||
func (s *sess) GetConnectionLimit() int32 {
|
||||
@@ -292,6 +299,7 @@ func (s *sess) RequestActivate(ctx context.Context, tofu string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.ApplyLocalTofuToken(tofu)
|
||||
s.ApplyLocalStatus(st)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user