diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 7aa8b1ae1e..b11401d20f 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.Collections.Frozen;
using System.Diagnostics;
using System.IO;
using System.Reflection;
@@ -53,7 +54,7 @@ namespace OpenSim.Framework.Serialization.External
///
/// true on successful, false if there were any processing failures
public static bool ExecuteReadProcessors(
- NodeType nodeToFill, Dictionary> processors, XmlReader xtr)
+ NodeType nodeToFill, FrozenDictionary> processors, XmlReader xtr)
{
return ExecuteReadProcessors(
nodeToFill,
@@ -77,7 +78,7 @@ namespace OpenSim.Framework.Serialization.External
/// true on successful, false if there were any processing failures
public static bool ExecuteReadProcessors(
NodeType nodeToFill,
- Dictionary> processors,
+ FrozenDictionary> processors,
XmlReader xtr,
Action parseExceptionAction)
{
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index 8e5ddf8ed9..abac4acc27 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Collections.Frozen;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -40,107 +41,66 @@ namespace OpenSim.Framework.Serialization.External
///
public class LandDataSerializer
{
-// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private static Dictionary> m_ldProcessors
- = new Dictionary>();
+ private static readonly FrozenDictionary> m_ldProcessors
+ = new Dictionary>()
+ {
+ { "Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area")) },
+ { "AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID")) },
+ { "AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID"))},
+ { "Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category")) },
+ { "ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate")) },
+ { "ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice")) },
+ { "GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID")) },
+ { "GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID")) },
+ { "IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned")) },
+ { "Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap")) },
+ { "Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description") },
+ { "Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags")) },
+ { "LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType")) },
+ { "Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name") },
+ { "Status", (ld, xtr) => ld.Status = (ParcelStatus) Convert.ToSByte(xtr.ReadElementString("Status")) },
+ { "LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID")) },
+ { "MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale")) },
+ { "MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID")) },
+ { "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL") },
+ { "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL") },
+ { "OwnerID", (ld, xtr) => ld.OwnerID = UUID.Parse(xtr.ReadElementString("OwnerID")) },
- private static Dictionary> m_laeProcessors
- = new Dictionary>();
+ { "ParcelAccessList", ProcessParcelAccessList },
+
+ { "Environment", ProcessParcelEnvironment },
+
+ { "PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours"))},
+ { "PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice"))},
+ { "SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice"))},
+ { "SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID"))},
+ { "UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation"))},
+ { "UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt"))},
+
+ { "OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime")) },
+ { "SeeAVs", (ld, xtr) => ld.SeeAVs = xtr.ReadElementString("SeeAVs") == "1" },
+ { "AnyAVSnds", (ld, xtr) => ld.AnyAVSounds = xtr.ReadElementString("AnyAVSnds") == "1" },
+ { "GrpAVSnds", (ld, xtr) => ld.GroupAVSounds = xtr.ReadElementString("GrpAVSnds") == "1" },
+ }.ToFrozenDictionary();
+
+ private static readonly FrozenDictionary> m_laeProcessors
+ = new Dictionary>()
+ {
+ { "AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID")) },
+ { "Time", (lae, xtr) =>
+ {
+ // We really don't care about temp vs perm here and this
+ // would break on old oars. Assume all bans are perm
+ xtr.ReadElementString("Time");
+ lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
+ } },
+ { "AccessList", (lae, xtr) => lae.Flags = (AccessList) Convert.ToUInt32(xtr.ReadElementString("AccessList")) }
+ }.ToFrozenDictionary();
static LandDataSerializer()
{
- // LandData processors
- m_ldProcessors.Add(
- "Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area")));
- m_ldProcessors.Add(
- "AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID")));
- m_ldProcessors.Add(
- "AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID")));
- m_ldProcessors.Add(
- "Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category")));
- m_ldProcessors.Add(
- "ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate")));
- m_ldProcessors.Add(
- "ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice")));
- m_ldProcessors.Add(
- "GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID")));
- m_ldProcessors.Add(
- "GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID")));
- m_ldProcessors.Add(
- "IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned")));
- m_ldProcessors.Add(
- "Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap")));
- m_ldProcessors.Add(
- "Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description"));
- m_ldProcessors.Add(
- "Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags")));
- m_ldProcessors.Add(
- "LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType")));
- m_ldProcessors.Add(
- "Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name"));
- m_ldProcessors.Add(
- "Status", (ld, xtr) => ld.Status = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status")));
- m_ldProcessors.Add(
- "LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID")));
- m_ldProcessors.Add(
- "MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale")));
- m_ldProcessors.Add(
- "MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID")));
- m_ldProcessors.Add(
- "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL"));
- m_ldProcessors.Add(
- "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL"));
- m_ldProcessors.Add(
- "OwnerID", (ld, xtr) => ld.OwnerID = UUID.Parse(xtr.ReadElementString("OwnerID")));
-
- m_ldProcessors.Add(
- "ParcelAccessList", ProcessParcelAccessList);
-
- m_ldProcessors.Add(
- "Environment", ProcessParcelEnvironment);
-
- m_ldProcessors.Add(
- "PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
- m_ldProcessors.Add(
- "PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice")));
- m_ldProcessors.Add(
- "SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice")));
- m_ldProcessors.Add(
- "SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID")));
- m_ldProcessors.Add(
- "UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation")));
- m_ldProcessors.Add(
- "UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt")));
-
- // No longer used here //
- // m_ldProcessors.Add("Dwell", (landData, xtr) => return);
-
- m_ldProcessors.Add(
- "OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime")));
-
- m_ldProcessors.Add(
- "SeeAVs", (ld, xtr) => ld.SeeAVs = xtr.ReadElementString("SeeAVs") == "1");
- m_ldProcessors.Add(
- "AnyAVSnds", (ld, xtr) => ld.AnyAVSounds = xtr.ReadElementString("AnyAVSnds") == "1");
- m_ldProcessors.Add(
- "GrpAVSnds", (ld, xtr) => ld.GroupAVSounds = xtr.ReadElementString("GrpAVSnds") == "1");
-
- // LandAccessEntryProcessors
- m_laeProcessors.Add(
- "AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID")));
- m_laeProcessors.Add(
- "Time", (lae, xtr) =>
- {
- // We really don't care about temp vs perm here and this
- // would break on old oars. Assume all bans are perm
- xtr.ReadElementString("Time");
- lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
- }
- );
- m_laeProcessors.Add(
- "AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
-
}
public static void ProcessParcelEnvironment(LandData ld, XmlReader xtr)
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index e8c811892a..a0a40af74c 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Collections.Frozen;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
@@ -44,34 +45,36 @@ namespace OpenSim.Framework.Serialization.External
///
public class UserInventoryItemSerializer
{
-// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private static Dictionary> m_InventoryItemXmlProcessors
- = new Dictionary>();
+ private static FrozenDictionary> m_InventoryItemXmlProcessors
+ = new Dictionary>()
+ {
+ { "Name", ProcessName },
+ { "ID", ProcessID },
+ { "InvType", ProcessInvType },
+ { "CreatorUUID", ProcessCreatorUUID },
+ { "CreatorID", ProcessCreatorID },
+ { "CreatorData", ProcessCreatorData },
+ { "CreationDate", ProcessCreationDate },
+ { "Owner", ProcessOwner },
+ { "Description", ProcessDescription },
+ { "AssetType", ProcessAssetType },
+ { "AssetID", ProcessAssetID },
+ { "SaleType", ProcessSaleType },
+ { "SalePrice", ProcessSalePrice },
+ { "BasePermissions", ProcessBasePermissions },
+ { "CurrentPermissions", ProcessCurrentPermissions },
+ { "EveryOnePermissions", ProcessEveryOnePermissions },
+ { "NextPermissions", ProcessNextPermissions },
+ { "Flags", ProcessFlags },
+ { "GroupID", ProcessGroupID },
+ { "GroupOwned", ProcessGroupOwned },
+ }.ToFrozenDictionary();
- #region InventoryItemBase Processor initialization
+ #region InventoryItemBase Processor initialization
static UserInventoryItemSerializer()
{
- m_InventoryItemXmlProcessors.Add("Name", ProcessName);
- m_InventoryItemXmlProcessors.Add("ID", ProcessID);
- m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType);
- m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID);
- m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
- m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData);
- m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate);
- m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner);
- m_InventoryItemXmlProcessors.Add("Description", ProcessDescription);
- m_InventoryItemXmlProcessors.Add("AssetType", ProcessAssetType);
- m_InventoryItemXmlProcessors.Add("AssetID", ProcessAssetID);
- m_InventoryItemXmlProcessors.Add("SaleType", ProcessSaleType);
- m_InventoryItemXmlProcessors.Add("SalePrice", ProcessSalePrice);
- m_InventoryItemXmlProcessors.Add("BasePermissions", ProcessBasePermissions);
- m_InventoryItemXmlProcessors.Add("CurrentPermissions", ProcessCurrentPermissions);
- m_InventoryItemXmlProcessors.Add("EveryOnePermissions", ProcessEveryOnePermissions);
- m_InventoryItemXmlProcessors.Add("NextPermissions", ProcessNextPermissions);
- m_InventoryItemXmlProcessors.Add("Flags", ProcessFlags);
- m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID);
- m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned);
}
#endregion
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 3bb475c8b1..a4fc27924a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -292,7 +292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
int nbytes =
await m_udpSocket.ReceiveFromAsync(buf.Data.AsMemory(), SocketFlags.None, workSktAddress, InboundCancellationSource.Token).ConfigureAwait(false);
- if (!m_IsRunningInbound)
+ if (!m_IsRunningInbound || InboundCancellationSource.IsCancellationRequested)
{
FreeUDPBuffer(buf);
return;
@@ -302,7 +302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
int startTick = Util.EnvironmentTickCount();
- buf.RemoteEndPoint = Util.GetEndPoint(workSktAddress);;
+ buf.RemoteEndPoint = Util.GetEndPoint(workSktAddress);
buf.DataLength = nbytes;
UdpReceives++;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 72ce3654c9..d4f9f1635b 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.Collections.Frozen;
using System.Drawing;
using System.IO;
using System.Reflection;
@@ -434,7 +435,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region manual serialization
- private static readonly Dictionary> m_SOPXmlProcessors = new()
+ private static readonly FrozenDictionary> m_SOPXmlProcessors = new Dictionary>()
{
{"AllowedDrop", ProcessAllowedDrop },
{"CreatorID", ProcessCreatorID },
@@ -526,9 +527,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{"SOPAnims", ProcessSOPAnims },
{"SitActRange", ProcessSitActRange }
- };
+ }.ToFrozenDictionary();
- private static readonly Dictionary> m_TaskInventoryXmlProcessors = new()
+ private static readonly FrozenDictionary> m_TaskInventoryXmlProcessors = new Dictionary>()
{
{"AssetID", ProcessTIAssetID },
{"BasePermissions", ProcessTIBasePermissions },
@@ -554,9 +555,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{"PermsMask", ProcessTIPermsMask },
{"Type", ProcessTIType },
{"OwnerChanged", ProcessTIOwnerChanged }
- };
+ }.ToFrozenDictionary();
- private static readonly Dictionary> m_ShapeXmlProcessors = new()
+ private static readonly FrozenDictionary> m_ShapeXmlProcessors = new Dictionary>()
{
{"ProfileCurve", ProcessShpProfileCurve },
{"TextureEntry", ProcessShpTextureEntry },
@@ -608,7 +609,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{"SculptEntry", ProcessShpSculptEntry },
{"Media", ProcessShpMedia },
{"MatOvrd", ProcessShpMatOvrd }
- };
+ }.ToFrozenDictionary();
#region SOPXmlProcessors
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlReader reader)