Browse Source

acl mutex on ISAllowed

Abhishek Kondur 2 years ago
parent
commit
ef6e66fcc4
1 changed files with 4 additions and 3 deletions
  1. 4 3
      logic/acls/common.go

+ 4 - 3
logic/acls/common.go

@@ -62,10 +62,11 @@ func (acl ACL) Save(containerID ContainerID, ID AclID) (ACL, error) {
 }
 }
 
 
 // ACL.IsAllowed - sees if ID is allowed in referring ACL
 // ACL.IsAllowed - sees if ID is allowed in referring ACL
-func (acl ACL) IsAllowed(ID AclID) bool {
+func (acl ACL) IsAllowed(ID AclID) (allowed bool) {
 	aclMutex.RLock()
 	aclMutex.RLock()
-	defer aclMutex.RUnlock()
-	return acl[ID] == Allowed
+	allowed = acl[ID] == Allowed
+	aclMutex.RUnlock()
+	return
 }
 }
 
 
 // ACLContainer.UpdateACL - saves the state of a ACL in the ACLContainer in memory
 // ACLContainer.UpdateACL - saves the state of a ACL in the ACLContainer in memory