소스 검색

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