Instantiate mutex and rename AuthenticationQueue to AuthenticationMap

master
Hugo Thunnissen 5 years ago
parent 03f316e06e
commit 76a977b319

@ -17,7 +17,7 @@ type AuthenticationMap struct {
} }
// Returns empty string when no request by that id is present // Returns empty string when no request by that id is present
func (q *AuthenticationMap) getRequestByID(ID string) *AuthRequest { func (q *AuthenticationMap) GetRequestByID(ID string) *AuthRequest {
q.requestMapMutex.RLock() q.requestMapMutex.RLock()
req, ok := q.requestMap[ID] req, ok := q.requestMap[ID]
@ -57,6 +57,7 @@ func (q *AuthenticationMap) QueueRequest(r *AuthRequest) error {
func (q *AuthenticationMap) Init() { func (q *AuthenticationMap) Init() {
q.requestMap = make(map[string]*AuthRequest) q.requestMap = make(map[string]*AuthRequest)
q.requestMapMutex = &sync.RWMutex{}
q.startRequestMapCleaner() q.startRequestMapCleaner()
} }
Loading…
Cancel
Save