diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index 75279fba1a8..5dc3165fbce 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -39,7 +39,7 @@ public class VersionInfo { public const string VersionNumber = "0.9.2.2"; public const string AssemblyVersionNumber = "0.9.2.2"; - public const string Release = "8729"; + public const string Release = "8736"; public static string Version { diff --git a/OpenSim/Region/Framework/Scenes/LinksetData.cs b/OpenSim/Region/Framework/Scenes/LinksetData.cs index 9fade411361..c5607e6eb04 100644 --- a/OpenSim/Region/Framework/Scenes/LinksetData.cs +++ b/OpenSim/Region/Framework/Scenes/LinksetData.cs @@ -17,8 +17,8 @@ public LinksetData() { Data = new SortedList(); - LinksetDataBytesFree = 0; - LinksetDataBytesUsed = LINKSETDATA_MAX; + LinksetDataBytesFree = LINKSETDATA_MAX; + LinksetDataBytesUsed = 0; } public SortedList Data { get; private set; } = null; @@ -26,6 +26,24 @@ public LinksetData() public int LinksetDataBytesFree { get; private set; } = LINKSETDATA_MAX; public int LinksetDataBytesUsed { get; private set; } = 0; + // Deep Copy of Linkset Data + public LinksetData Copy() + { + lock (linksetDataLock) + { + var copy = new LinksetData(); + foreach (var entry in Data) + { + var key = String.Copy(entry.Key); + var val = entry.Value.Copy(); + copy.Data.Add(key, val); + copy.LinksetDataAccountingDelta(val.GetCost(key)); + } + + return copy; + } + } + /// /// Adds or updates a entry to linkset data /// @@ -232,7 +250,7 @@ public string[] LinksetDataMultiDelete(string pattern, string pass, out int dele public bool LinksetDataOverLimit() { - return (LinksetDataBytesFree < 0); + return (LinksetDataBytesFree <= 0); } /// @@ -259,15 +277,18 @@ public void MergeLinksetData(LinksetData otherLinksetData) if (LinksetDataOverLimit()) break; - var value = new LinksetDataEntry(kvp.Value.Value, kvp.Value.Password); - Data.Add(kvp.Key, value); - LinksetDataAccountingDelta(value.GetCost(kvp.Key)); + var key = string.Copy(kvp.Key); + var value = kvp.Value.Copy(); + + Data.Add(key, value); + LinksetDataAccountingDelta(value.GetCost(key)); } // Clear the LinksetData entries from the "other" SOG otherLinksetData.Data.Clear(); - otherLinksetData.LinksetDataBytesFree = 0; - otherLinksetData.LinksetDataBytesUsed = LINKSETDATA_MAX; + + otherLinksetData.LinksetDataBytesFree = LINKSETDATA_MAX; + otherLinksetData.LinksetDataBytesUsed = 0; } } @@ -306,8 +327,8 @@ public void ResetLinksetData() Data.Clear(); - LinksetDataBytesFree = 0; - LinksetDataBytesUsed = LINKSETDATA_MAX; + LinksetDataBytesFree = LINKSETDATA_MAX; + LinksetDataBytesUsed = 0; } } @@ -326,11 +347,10 @@ public string SerializeLinksetData() private void LinksetDataAccountingDelta(int delta) { LinksetDataBytesUsed += delta; - - if (LinksetDataBytesUsed < 0) - LinksetDataBytesUsed = 0; - LinksetDataBytesFree = LINKSETDATA_MAX - LinksetDataBytesUsed; + + if (LinksetDataBytesFree < 0) + LinksetDataBytesFree = 0; } } @@ -338,8 +358,8 @@ public class LinksetDataEntry { public LinksetDataEntry(string value, string password) { - this.Value = value; - this.Password = password; + Value = value; + Password = password; } public string Password { get; private set; } = string.Empty; @@ -350,12 +370,18 @@ public bool CheckPassword(string pass) { // A undocumented caveat for LinksetData appears to be that even for unprotected values, // if a pass is provided, it is still treated as protected - return this.Password == pass ? true : false; + return string.IsNullOrEmpty(Password) || (Password == pass); } public string CheckPasswordAndGetValue(string pass) { - return (string.IsNullOrEmpty(this.Password) || (this.Password == pass)) ? this.Value : string.Empty; + return CheckPassword(pass) ? Value : string.Empty; + } + + // Deep Copy of Current Entry + public LinksetDataEntry Copy() + { + return new LinksetDataEntry(String.Copy(Value), Password ?? String.Copy(Password)); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 187ca2b15f5..c46dead5f5f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2664,10 +2664,17 @@ public SceneObjectGroup Copy(bool userExposed) public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) { SceneObjectPart newpart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed); -// SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed); -// newpart.LocalId = m_scene.AllocateLocalId(); + // SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed); + // newpart.LocalId = m_scene.AllocateLocalId(); + + // If the rootpart we're copying has LinksetData do a deep copy of that to the new rootpart. + if (part.LinksetData != null) + { + newpart.LinksetData = part.LinksetData.Copy(); + } SetRootPart(newpart); + if (userExposed) RootPart.Velocity = Vector3.Zero; // In case source is moving }