Fix picking wrong token lock

This commit is contained in:
Jeff Mitchell 2016-06-27 11:17:08 -04:00
parent 185bcb7b48
commit 09720bbd8e

View file

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"regexp" "regexp"
"strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -92,8 +91,7 @@ func NewTokenStore(c *Core, config *logical.BackendConfig) (*TokenStore, error)
t.tokenLocks = map[string]*sync.RWMutex{} t.tokenLocks = map[string]*sync.RWMutex{}
for i := int64(0); i < 256; i++ { for i := int64(0); i < 256; i++ {
t.tokenLocks[fmt.Sprintf("%2x", t.tokenLocks[fmt.Sprintf("%02x", i)] = &sync.RWMutex{}
strconv.FormatInt(i, 16))] = &sync.RWMutex{}
} }
t.tokenLocks["custom"] = &sync.RWMutex{} t.tokenLocks["custom"] = &sync.RWMutex{}