summaryrefslogtreecommitdiffstats
path: root/sms-service
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2018-03-13 13:50:17 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2018-03-14 16:28:25 +0000
commit048ab0daafdb754dbfefbce0e4e01ca9e5a48a7b (patch)
tree9a935756afd531ac4ef5576d8ca88372d4065852 /sms-service
parentd30732db3572050948a6c90f6eb4aabfc15d8cc2 (diff)
Using embedded lock for vault struct
Using an embedded lock instead of an explicit variable Issue-ID: AAF-92 Change-Id: Ia7bd43a40ec50664b042afa9e46091f14122ba5c Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'sms-service')
-rw-r--r--sms-service/src/sms/backend/vault.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/sms-service/src/sms/backend/vault.go b/sms-service/src/sms/backend/vault.go
index ac5cc67..fa8316c 100644
--- a/sms-service/src/sms/backend/vault.go
+++ b/sms-service/src/sms/backend/vault.go
@@ -31,12 +31,12 @@ import (
// Vault is the main Struct used in Backend to initialize the struct
type Vault struct {
+ sync.Mutex
engineType string
initRoleDone bool
policyName string
roleID string
secretID string
- tokenLock sync.Mutex
vaultAddress string
vaultClient *vaultapi.Client
vaultMount string
@@ -321,8 +321,8 @@ func (v *Vault) initRole() error {
// Function checkToken() gets called multiple times to create
// temporary tokens
func (v *Vault) checkToken() error {
- v.tokenLock.Lock()
- defer v.tokenLock.Unlock()
+ v.Lock()
+ defer v.Unlock()
// Init Role if it is not yet done
// Role needs to be created before token can be created