now i can login on win .net4.8, but just a little drop on a large (broken) OSD ocean. some of this changes are actually good even on good JIT. Failure seems to be on same code pattern, but same points seem to vary with each JIT compilation, sometimes work, others don't, others always fail, etc

This commit is contained in:
UbitUmarov
2019-07-30 23:26:29 +01:00
parent 185ed42123
commit 944a785a32
9 changed files with 366 additions and 310 deletions

View File

@@ -267,16 +267,17 @@ namespace OpenSim.Framework
/// <param name="args"></param>
public void UnpackAgentCircuitData(OSDMap args)
{
if (args["agent_id"] != null)
AgentID = args["agent_id"].AsUUID();
if (args["base_folder"] != null)
BaseFolder = args["base_folder"].AsUUID();
if (args["caps_path"] != null)
CapsPath = args["caps_path"].AsString();
OSD tmpOSD;
if (args.TryGetValue("agent_id", out tmpOSD))
AgentID = tmpOSD.AsUUID();
if (args.TryGetValue("base_folder", out tmpOSD))
BaseFolder =tmpOSD.AsUUID();
if (args.TryGetValue("caps_path", out tmpOSD))
CapsPath = tmpOSD.AsString();
if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OSDType.Array))
if ((args.TryGetValue("children_seeds", out tmpOSD) && tmpOSD is OSDArray))
{
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
OSDArray childrenSeeds = (OSDArray)tmpOSD;
ChildrenCapSeeds = new Dictionary<ulong, string>();
foreach (OSD o in childrenSeeds)
{
@@ -285,53 +286,59 @@ namespace OpenSim.Framework
ulong handle = 0;
string seed = "";
OSDMap pair = (OSDMap)o;
if (pair["handle"] != null)
if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
if (pair.TryGetValue("handle", out tmpOSD))
{
if (!UInt64.TryParse(tmpOSD.AsString(), out handle))
continue;
if (pair["seed"] != null)
seed = pair["seed"].AsString();
}
if (!ChildrenCapSeeds.ContainsKey(handle))
ChildrenCapSeeds.Add(handle, seed);
{
if (pair.TryGetValue("seed", out tmpOSD))
{
seed = tmpOSD.AsString();
ChildrenCapSeeds.Add(handle, seed);
}
}
}
}
}
else
ChildrenCapSeeds = new Dictionary<ulong, string>();
if (args["child"] != null)
child = args["child"].AsBoolean();
if (args["circuit_code"] != null)
UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode);
if (args["first_name"] != null)
firstname = args["first_name"].AsString();
if (args["last_name"] != null)
lastname = args["last_name"].AsString();
if (args["inventory_folder"] != null)
InventoryFolder = args["inventory_folder"].AsUUID();
if (args["secure_session_id"] != null)
SecureSessionID = args["secure_session_id"].AsUUID();
if (args["session_id"] != null)
SessionID = args["session_id"].AsUUID();
if (args["service_session_id"] != null)
ServiceSessionID = args["service_session_id"].AsString();
if (args["client_ip"] != null)
IPAddress = args["client_ip"].AsString();
if (args["viewer"] != null)
Viewer = args["viewer"].AsString();
if (args["channel"] != null)
Channel = args["channel"].AsString();
if (args["mac"] != null)
Mac = args["mac"].AsString();
if (args["id0"] != null)
Id0 = args["id0"].AsString();
if (args["teleport_flags"] != null)
teleportFlags = args["teleport_flags"].AsUInteger();
if (args.TryGetValue("child", out tmpOSD))
child = tmpOSD.AsBoolean();
if (args.TryGetValue("circuit_code", out tmpOSD))
UInt32.TryParse(tmpOSD.AsString(), out circuitcode);
if (args.TryGetValue("first_name", out tmpOSD))
firstname = tmpOSD.AsString();
if (args.TryGetValue("last_name", out tmpOSD))
lastname = tmpOSD.AsString();
if (args.TryGetValue("inventory_folder", out tmpOSD))
InventoryFolder = tmpOSD.AsUUID();
if (args.TryGetValue("secure_session_id", out tmpOSD))
SecureSessionID = tmpOSD.AsUUID();
if (args.TryGetValue("session_id", out tmpOSD))
SessionID = tmpOSD.AsUUID();
if (args.TryGetValue("service_session_id", out tmpOSD))
ServiceSessionID = tmpOSD.AsString();
if (args.TryGetValue("client_ip", out tmpOSD))
IPAddress = tmpOSD.AsString();
if (args.TryGetValue("viewer", out tmpOSD))
Viewer = tmpOSD.AsString();
if (args.TryGetValue("channel", out tmpOSD))
Channel = tmpOSD.AsString();
if (args.TryGetValue("mac", out tmpOSD))
Mac = tmpOSD.AsString();
if (args.TryGetValue("id0", out tmpOSD))
Id0 = tmpOSD.AsString();
if (args.TryGetValue("teleport_flags", out tmpOSD))
teleportFlags = tmpOSD.AsUInteger();
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
if (args.TryGetValue("start_pos", out tmpOSD))
Vector3.TryParse(tmpOSD.AsString(), out startpos);
if(args["far"] != null)
startfar = (float)args["far"].AsReal();
if(args.TryGetValue("far", out tmpOSD))
startfar = (float)tmpOSD.AsReal();
//m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
@@ -342,12 +349,12 @@ namespace OpenSim.Framework
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
if (args["appearance_serial"] != null)
Appearance.Serial = args["appearance_serial"].AsInteger();
if (args.TryGetValue("appearance_serial", out tmpOSD))
Appearance.Serial = tmpOSD.AsInteger();
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
if (args.TryGetValue("packed_appearance", out tmpOSD) && (tmpOSD is OSDMap))
{
Appearance.Unpack((OSDMap)args["packed_appearance"]);
Appearance.Unpack((OSDMap)tmpOSD);
// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
}
else
@@ -362,31 +369,31 @@ namespace OpenSim.Framework
ServiceURLs = new Dictionary<string, object>();
// Try parse the new way, OSDMap
if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map)
if (args.TryGetValue("serviceurls", out tmpOSD) && (tmpOSD is OSDMap))
{
OSDMap urls = (OSDMap)(args["serviceurls"]);
OSDMap urls = (OSDMap)tmpOSD;
foreach (KeyValuePair<String, OSD> kvp in urls)
{
ServiceURLs[kvp.Key] = kvp.Value.AsString();
tmpOSD = kvp.Value;
ServiceURLs[kvp.Key] = tmpOSD.AsString();
//System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
}
}
// else try the old way, OSDArray
// OBSOLETE -- soon to be deleted
else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
else if (args.TryGetValue("service_urls", out tmpOSD) && (tmpOSD is OSDArray))
{
OSDArray urls = (OSDArray)(args["service_urls"]);
for (int i = 0; i < urls.Count / 2; i++)
OSDArray urls = (OSDArray)tmpOSD;
OSD tmpOSDb;
for (int i = 0; i < urls.Count - 1; i += 2)
{
ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString();
tmpOSD = urls[i];
tmpOSDb = urls[i + 1];
ServiceURLs[tmpOSD.AsString()] = tmpOSDb.AsString();
//System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString());
}
}
}
}
}

View File

@@ -796,25 +796,33 @@ namespace OpenSim.Framework
/// </summary>
public void Unpack(OSDMap data)
{
if ((data != null) && (data["serial"] != null))
m_serial = data["serial"].AsInteger();
if ((data != null) && (data["height"] != null))
SetDefaultWearables();
SetDefaultTexture();
SetDefaultParams();
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
if(data == null)
{
m_log.Warn("[AVATAR APPEARANCE]: data to unpack is null");
return;
}
OSD tmpOSD;
if (data.TryGetValue("serial", out tmpOSD))
m_serial = tmpOSD.AsInteger();
if (data.TryGetValue("height", out tmpOSD))
// m_avatarHeight = (float)data["height"].AsReal();
SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal()));
SetSize(new Vector3(0.45f,0.6f, (float)tmpOSD.AsReal()));
try
{
// Wearables
SetDefaultWearables();
if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
{
OSDArray wears = (OSDArray)(data["wearables"]);
OSDArray wears = (OSDArray)tmpOSD;
m_wearables = new AvatarWearable[wears.Count];
int count = wears.Count;
m_wearables = new AvatarWearable[count];
for (int i = 0; i < count; i++)
for (int i = 0; i < wears.Count; i++)
m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
}
else
@@ -823,15 +831,15 @@ namespace OpenSim.Framework
}
// Avatar Textures
SetDefaultTexture();
if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
{
OSDArray textures = (OSDArray)(data["textures"]);
OSDArray textures = (OSDArray)tmpOSD;
for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
{
UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
if (textures[i] != null)
textureID = textures[i].AsUUID();
tmpOSD = textures[i];
if (tmpOSD != null)
textureID = tmpOSD.AsUUID();
m_texture.CreateFace((uint)i).TextureID = new UUID(textureID);
}
}
@@ -840,18 +848,17 @@ namespace OpenSim.Framework
m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
}
if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array)
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
{
OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]);
OSDArray bakedOSDArray = (OSDArray)tmpOSD;
m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
}
// Visual Parameters
SetDefaultParams();
if ((data != null) && (data["visualparams"] != null))
if (data.TryGetValue("visualparams", out tmpOSD))
{
if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array))
m_visualparams = data["visualparams"].AsBinary();
if (tmpOSD is OSDBinary || tmpOSD is OSDArray)
m_visualparams = tmpOSD.AsBinary();
}
else
{
@@ -859,10 +866,9 @@ namespace OpenSim.Framework
}
// Attachments
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
{
OSDArray attachs = (OSDArray)(data["attachments"]);
OSDArray attachs = (OSDArray)tmpOSD;
for (int i = 0; i < attachs.Count; i++)
{
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);

View File

@@ -68,11 +68,18 @@ namespace OpenSim.Framework
public void Unpack(OSDMap args)
{
if (args["point"] != null)
AttachPoint = args["point"].AsInteger();
OSD tmpOSD;
if (args.TryGetValue("point", out tmpOSD))
AttachPoint = tmpOSD.AsInteger();
if (args.TryGetValue("item", out tmpOSD))
ItemID = tmpOSD.AsUUID();
else
ItemID = UUID.Zero;
ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
if (args.TryGetValue("asset", out tmpOSD))
AssetID = tmpOSD.AsUUID();
else
AssetID = UUID.Zero;
}
}
}

View File

@@ -132,10 +132,12 @@ namespace OpenSim.Framework
public void Unpack(OSDArray args)
{
Clear();
OSD tmpOSDA, tmpOSDB;
foreach (OSDMap weardata in args)
{
Add(weardata["item"].AsUUID(), weardata["asset"].AsUUID());
tmpOSDA = weardata["item"];
tmpOSDB = weardata["asset"];
Add(tmpOSDA.AsUUID(), tmpOSDB.AsUUID());
}
}

View File

@@ -58,13 +58,13 @@ namespace OpenSim.Framework
public void Unpack(OSD data)
{
OSDMap map = (OSDMap)data;
if (map.ContainsKey("InboundVersion"))
InboundVersion = (float)map["InboundVersion"].AsReal();
if (map.ContainsKey("OutboundVersion"))
OutboundVersion = (float)map["OutboundVersion"].AsReal();
if (map.ContainsKey("WearablesCount"))
WearablesCount = map["WearablesCount"].AsInteger();
OSD tmpOSD;
if (map.TryGetValue("InboundVersion", out tmpOSD))
InboundVersion = (float)tmpOSD.AsReal();
if (map.TryGetValue("OutboundVersion", out tmpOSD))
OutboundVersion = (float)tmpOSD.AsReal();
if (map.TryGetValue("WearablesCount", out tmpOSD))
WearablesCount = tmpOSD.AsInteger();
}
}
}

View File

@@ -161,17 +161,20 @@ namespace OpenSim.Framework
public static WearableCacheItem[] BakedFromOSD(OSD pInput)
{
WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem();
OSD tmpOSD;
if (pInput.Type == OSDType.Array)
{
OSDArray itemarray = (OSDArray)pInput;
foreach (OSDMap item in itemarray)
{
int idx = (int)item["textureindex"].AsUInteger();
tmpOSD = item["textureindex"];
int idx = tmpOSD.AsInteger();
if (idx < 0 || idx > pcache.Length)
continue;
pcache[idx].CacheId = item["cacheid"].AsUUID();
pcache[idx].TextureID = item["textureid"].AsUUID();
tmpOSD = item["cacheid"];
pcache[idx].CacheId = tmpOSD.AsUUID();
tmpOSD = item["textureid"];
pcache[idx].TextureID = tmpOSD.AsUUID();
/*
if (item.ContainsKey("assetdata"))
{