Explorar el Código

acl mutex on ISAllowed

Abhishek Kondur hace 2 años
padre
commit
ef6e66fcc4
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  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
-func (acl ACL) IsAllowed(ID AclID) bool {
+func (acl ACL) IsAllowed(ID AclID) (allowed bool) {
 	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