add a usefull taint and update

httptests
UbitUmarov 2017-04-27 00:02:01 +01:00
parent ce655056ca
commit 8d3d87e0b2
2 changed files with 69 additions and 27 deletions

View File

@ -252,18 +252,26 @@ namespace OpenSim.Region.Framework.Scenes
} }
// new test code, to place in better place later // new test code, to place in better place later
private object PermissionsLock = new object(); private object m_PermissionsLock = new object();
private bool m_EffectivePermsInvalid = true;
public void InvalidateEffectivePerms()
{
lock(m_PermissionsLock)
m_EffectivePermsInvalid = true;
}
private uint m_EffectiveEveryOnePerms; private uint m_EffectiveEveryOnePerms;
public uint EffectiveEveryOnePerms public uint EffectiveEveryOnePerms
{ {
get get
{ {
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) lock(m_PermissionsLock)
// bc this is on heavy duty code paths {
// but for now we need to test the concept if(m_EffectivePermsInvalid)
// AggregateDeepPerms(); AggregatePerms();
return m_EffectiveEveryOnePerms; return m_EffectiveEveryOnePerms;
}
} }
} }
@ -272,11 +280,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) lock(m_PermissionsLock)
// bc this is on heavy duty code paths {
// but for now we need to test the concept if(m_EffectivePermsInvalid)
// AggregateDeepPerms(); AggregatePerms();
return m_EffectiveGroupPerms; return m_EffectiveGroupPerms;
}
} }
} }
@ -285,11 +294,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) lock(m_PermissionsLock)
// bc this is on heavy duty code paths {
// but for now we need to test the concept if(m_EffectivePermsInvalid)
// AggregateDeepPerms(); AggregatePerms();
return m_EffectiveGroupOrEveryOnePerms; return m_EffectiveGroupOrEveryOnePerms;
}
} }
} }
@ -298,11 +308,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) lock(m_PermissionsLock)
// bc this is on heavy duty code paths {
// but for now we need to test the concept if(m_EffectivePermsInvalid)
// AggregateDeepPerms(); AggregatePerms();
return m_EffectiveOwnerPerms; return m_EffectiveOwnerPerms;
}
} }
} }
@ -310,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
// AggregatePerms does same using cached parts content perms // AggregatePerms does same using cached parts content perms
public void AggregateDeepPerms() public void AggregateDeepPerms()
{ {
lock(PermissionsLock) lock(m_PermissionsLock)
{ {
// aux // aux
const uint allmask = (uint)PermissionMask.AllEffective; const uint allmask = (uint)PermissionMask.AllEffective;
@ -370,6 +381,7 @@ namespace OpenSim.Region.Framework.Scenes
m_EffectiveEveryOnePerms = everyone & owner; m_EffectiveEveryOnePerms = everyone & owner;
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
m_EffectivePermsInvalid = false;
} }
} }
@ -377,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes
// ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
public void AggregatePerms() public void AggregatePerms()
{ {
lock(PermissionsLock) lock(m_PermissionsLock)
{ {
// aux // aux
const uint allmask = (uint)PermissionMask.AllEffective; const uint allmask = (uint)PermissionMask.AllEffective;
@ -394,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes
uint rootEveryonePerms = RootPart.EveryoneMask; uint rootEveryonePerms = RootPart.EveryoneMask;
uint everyone = rootEveryonePerms; uint everyone = rootEveryonePerms;
bool needUpdate = false;
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
@ -409,7 +423,12 @@ namespace OpenSim.Region.Framework.Scenes
owner |= (uint)PermissionMask.Transfer; owner |= (uint)PermissionMask.Transfer;
owner &= basePerms; owner &= basePerms;
m_EffectiveOwnerPerms = owner; if(owner != m_EffectiveOwnerPerms)
{
needUpdate = true;
m_EffectiveOwnerPerms = owner;
}
uint ownertransfermask = owner & (uint)PermissionMask.Transfer; uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
// recover modify and move // recover modify and move
@ -421,7 +440,12 @@ namespace OpenSim.Region.Framework.Scenes
group |= ownertransfermask; group |= ownertransfermask;
uint groupOrEveryone = group; uint groupOrEveryone = group;
m_EffectiveGroupPerms = group & owner; uint tmpPerms = group & owner;
if(tmpPerms != m_EffectiveGroupPerms)
{
needUpdate = true;
m_EffectiveGroupPerms = tmpPerms;
}
// recover move // recover move
rootEveryonePerms &= (uint)PermissionMask.Move; rootEveryonePerms &= (uint)PermissionMask.Move;
@ -434,8 +458,24 @@ namespace OpenSim.Region.Framework.Scenes
groupOrEveryone |= everyone; groupOrEveryone |= everyone;
m_EffectiveEveryOnePerms = everyone & owner; tmpPerms = everyone & owner;
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; if(tmpPerms != m_EffectiveEveryOnePerms)
{
needUpdate = true;
m_EffectiveEveryOnePerms = tmpPerms;
}
tmpPerms = groupOrEveryone & owner;
if(tmpPerms != m_EffectiveGroupOrEveryOnePerms)
{
needUpdate = true;
m_EffectiveGroupOrEveryOnePerms = tmpPerms;
}
m_EffectivePermsInvalid = false;
if(needUpdate)
RootPart.ScheduleFullUpdate();
} }
} }

View File

@ -2579,6 +2579,8 @@ namespace OpenSim.Region.Framework.Scenes
AggregatedInnerOwnerPerms = owner & mask; AggregatedInnerOwnerPerms = owner & mask;
AggregatedInnerGroupPerms = group & mask; AggregatedInnerGroupPerms = group & mask;
AggregatedInnerEveryonePerms = everyone & mask; AggregatedInnerEveryonePerms = everyone & mask;
if(ParentGroup != null)
ParentGroup.InvalidateEffectivePerms();
} }
} }