瀏覽代碼

acl mutex on ISAllowed

Abhishek Kondur 2 年之前
父節點
當前提交
ef6e66fcc4
共有 1 個文件被更改,包括 4 次插入3 次删除
  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