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

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

View File

@ -796,25 +796,33 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public void Unpack(OSDMap data) public void Unpack(OSDMap data)
{ {
if ((data != null) && (data["serial"] != null)) SetDefaultWearables();
m_serial = data["serial"].AsInteger(); SetDefaultTexture();
if ((data != null) && (data["height"] != null)) 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(); // 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 try
{ {
// Wearables // Wearables
SetDefaultWearables(); if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
{ {
OSDArray wears = (OSDArray)(data["wearables"]); OSDArray wears = (OSDArray)tmpOSD;
m_wearables = new AvatarWearable[wears.Count];
int count = wears.Count; for (int i = 0; i < wears.Count; i++)
m_wearables = new AvatarWearable[count];
for (int i = 0; i < count; i++)
m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
} }
else else
@ -823,15 +831,15 @@ namespace OpenSim.Framework
} }
// Avatar Textures // Avatar Textures
SetDefaultTexture(); if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
{ {
OSDArray textures = (OSDArray)(data["textures"]); OSDArray textures = (OSDArray)tmpOSD;
for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
{ {
UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
if (textures[i] != null) tmpOSD = textures[i];
textureID = textures[i].AsUUID(); if (tmpOSD != null)
textureID = tmpOSD.AsUUID();
m_texture.CreateFace((uint)i).TextureID = new UUID(textureID); 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"); 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); m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
} }
// Visual Parameters // Visual Parameters
SetDefaultParams(); if (data.TryGetValue("visualparams", out tmpOSD))
if ((data != null) && (data["visualparams"] != null))
{ {
if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array)) if (tmpOSD is OSDBinary || tmpOSD is OSDArray)
m_visualparams = data["visualparams"].AsBinary(); m_visualparams = tmpOSD.AsBinary();
} }
else else
{ {
@ -859,10 +866,9 @@ namespace OpenSim.Framework
} }
// Attachments // Attachments
m_attachments = new Dictionary<int, List<AvatarAttachment>>(); if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
{ {
OSDArray attachs = (OSDArray)(data["attachments"]); OSDArray attachs = (OSDArray)tmpOSD;
for (int i = 0; i < attachs.Count; i++) for (int i = 0; i < attachs.Count; i++)
{ {
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]); AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);

View File

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

View File

@ -132,10 +132,12 @@ namespace OpenSim.Framework
public void Unpack(OSDArray args) public void Unpack(OSDArray args)
{ {
Clear(); Clear();
OSD tmpOSDA, tmpOSDB;
foreach (OSDMap weardata in args) 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) public void Unpack(OSD data)
{ {
OSDMap map = (OSDMap)data; OSDMap map = (OSDMap)data;
OSD tmpOSD;
if (map.ContainsKey("InboundVersion")) if (map.TryGetValue("InboundVersion", out tmpOSD))
InboundVersion = (float)map["InboundVersion"].AsReal(); InboundVersion = (float)tmpOSD.AsReal();
if (map.ContainsKey("OutboundVersion")) if (map.TryGetValue("OutboundVersion", out tmpOSD))
OutboundVersion = (float)map["OutboundVersion"].AsReal(); OutboundVersion = (float)tmpOSD.AsReal();
if (map.ContainsKey("WearablesCount")) if (map.TryGetValue("WearablesCount", out tmpOSD))
WearablesCount = map["WearablesCount"].AsInteger(); WearablesCount = tmpOSD.AsInteger();
} }
} }
} }

View File

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

View File

@ -267,6 +267,7 @@ namespace OpenSim.Region.OptionalModules.Materials
if (matsArr == null) if (matsArr == null)
return partchanged; return partchanged;
OSD tmpOSD;
foreach (OSD elemOsd in matsArr) foreach (OSD elemOsd in matsArr)
{ {
if (elemOsd != null && elemOsd is OSDMap) if (elemOsd != null && elemOsd is OSDMap)
@ -278,7 +279,8 @@ namespace OpenSim.Region.OptionalModules.Materials
{ {
lock (materialslock) lock (materialslock)
{ {
UUID id = matMap["ID"].AsUUID(); tmpOSD = matMap["ID"];
UUID id = tmpOSD.AsUUID();
if(m_Materials.ContainsKey(id)) if(m_Materials.ContainsKey(id))
continue; continue;
@ -459,12 +461,13 @@ namespace OpenSim.Region.OptionalModules.Materials
OSDMap resp = new OSDMap(); OSDMap resp = new OSDMap();
OSDArray respArr = new OSDArray(); OSDArray respArr = new OSDArray();
OSD tmpOSD;
if (req.ContainsKey("Zipped")) if (req.TryGetValue("Zipped", out tmpOSD))
{ {
OSD osd = null; OSD osd = null;
byte[] inBytes = req["Zipped"].AsBinary(); byte[] inBytes = tmpOSD.AsBinary();
try try
{ {
@ -531,12 +534,13 @@ namespace OpenSim.Region.OptionalModules.Materials
OSDArray respArr = new OSDArray(); OSDArray respArr = new OSDArray();
OSD tmpOSD;
HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>(); HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>();
if (req.ContainsKey("Zipped")) if (req.TryGetValue("Zipped", out tmpOSD))
{ {
OSD osd = null; OSD osd = null;
byte[] inBytes = req["Zipped"].AsBinary(); byte[] inBytes = tmpOSD.AsBinary();
try try
{ {
@ -546,145 +550,141 @@ namespace OpenSim.Region.OptionalModules.Materials
{ {
materialsFromViewer = osd as OSDMap; materialsFromViewer = osd as OSDMap;
if (materialsFromViewer.ContainsKey("FullMaterialsPerFace")) if (materialsFromViewer.TryGetValue("FullMaterialsPerFace", out tmpOSD) && (tmpOSD is OSDArray))
{ {
OSD matsOsd = materialsFromViewer["FullMaterialsPerFace"]; OSDArray matsArr = tmpOSD as OSDArray;
if (matsOsd is OSDArray) try
{ {
OSDArray matsArr = matsOsd as OSDArray; foreach (OSDMap matsMap in matsArr)
try
{ {
foreach (OSDMap matsMap in matsArr) uint primLocalID = 0;
try
{ {
uint primLocalID = 0; tmpOSD = matsMap["ID"];
try primLocalID = tmpOSD.AsUInteger();
{ }
primLocalID = matsMap["ID"].AsUInteger(); catch (Exception e)
} {
catch (Exception e) m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
{ continue;
m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message); }
continue;
}
SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID); SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
if (sop == null) if (sop == null)
{ {
m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString()); m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString());
continue; continue;
} }
if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID)) if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID))
{ {
m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID); m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
continue; continue;
} }
OSDMap mat = null; OSDMap mat = null;
try try
{ {
mat = matsMap["Material"] as OSDMap; mat = matsMap["Material"] as OSDMap;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message); m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
continue; continue;
} }
Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length); Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
if (te == null) if (te == null)
{ {
m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID); m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID);
continue; continue;
} }
int face = -1; int face = -1;
UUID oldid = UUID.Zero; UUID oldid = UUID.Zero;
Primitive.TextureEntryFace faceEntry = null; Primitive.TextureEntryFace faceEntry = null;
if (matsMap.ContainsKey("Face")) if (matsMap.TryGetValue("Face", out tmpOSD))
{ {
face = matsMap["Face"].AsInteger(); face = tmpOSD.AsInteger();
faceEntry = te.CreateFace((uint)face); faceEntry = te.CreateFace((uint)face);
} }
else else
faceEntry = te.DefaultTexture; faceEntry = te.DefaultTexture;
if (faceEntry == null) if (faceEntry == null)
continue; continue;
UUID id; UUID id;
FaceMaterial newFaceMat = null; FaceMaterial newFaceMat = null;
if (mat == null) if (mat == null)
{ {
// This happens then the user removes a material from a prim // This happens then the user removes a material from a prim
id = UUID.Zero;
}
else
{
newFaceMat = new FaceMaterial(mat);
if(newFaceMat.DiffuseAlphaMode == 1
&& newFaceMat.NormalMapID == UUID.Zero
&& newFaceMat.SpecularMapID == UUID.Zero
)
id = UUID.Zero; id = UUID.Zero;
}
else else
{ {
newFaceMat = new FaceMaterial(mat); newFaceMat.genID();
if(newFaceMat.DiffuseAlphaMode == 1 id = newFaceMat.ID;
&& newFaceMat.NormalMapID == UUID.Zero }
&& newFaceMat.SpecularMapID == UUID.Zero }
)
id = UUID.Zero; oldid = faceEntry.MaterialID;
if(oldid == id)
continue;
if (faceEntry != null)
{
faceEntry.MaterialID = id;
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
sop.Shape.TextureEntry = te.GetBytes(9);
}
if(oldid != UUID.Zero)
RemoveMaterial(oldid);
lock(materialslock)
{
if(id != UUID.Zero)
{
if (m_Materials.ContainsKey(id))
m_MaterialsRefCount[id]++;
else else
{ {
newFaceMat.genID(); m_Materials[id] = newFaceMat;
id = newFaceMat.ID; m_MaterialsRefCount[id] = 1;
m_changed[newFaceMat] = Util.GetTimeStamp();
} }
} }
oldid = faceEntry.MaterialID;
if(oldid == id)
continue;
if (faceEntry != null)
{
faceEntry.MaterialID = id;
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
sop.Shape.TextureEntry = te.GetBytes(9);
}
if(oldid != UUID.Zero)
RemoveMaterial(oldid);
lock(materialslock)
{
if(id != UUID.Zero)
{
if (m_Materials.ContainsKey(id))
m_MaterialsRefCount[id]++;
else
{
m_Materials[id] = newFaceMat;
m_MaterialsRefCount[id] = 1;
m_changed[newFaceMat] = Util.GetTimeStamp();
}
}
}
if(!parts.Contains(sop))
parts.Add(sop);
} }
foreach(SceneObjectPart sop in parts) if(!parts.Contains(sop))
{ parts.Add(sop);
if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
{
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
sop.ScheduleFullUpdate();
sop.ParentGroup.HasGroupChanged = true;
}
}
} }
catch (Exception e)
foreach(SceneObjectPart sop in parts)
{ {
m_log.Warn("[Materials]: exception processing received material ", e); if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
{
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
sop.ScheduleFullUpdate();
sop.ParentGroup.HasGroupChanged = true;
}
} }
} }
catch (Exception e)
{
m_log.Warn("[Materials]: exception processing received material ", e);
}
} }
} }
} }

View File

@ -115,15 +115,10 @@ namespace OpenSim.Server.Handlers.Simulation
return responsedata; return responsedata;
} }
} }
protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
{ {
Culture.SetCurrentCulture();
EntityTransferContext ctx = new EntityTransferContext();
if (m_SimulationService == null) if (m_SimulationService == null)
{ {
m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
@ -134,33 +129,37 @@ namespace OpenSim.Server.Handlers.Simulation
return; return;
} }
Culture.SetCurrentCulture();
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
OSDMap args = Utils.GetOSDMap((string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]);
bool viaTeleport = true; bool viaTeleport = true;
if (args.ContainsKey("viaTeleport")) OSD tmpOSD;
viaTeleport = args["viaTeleport"].AsBoolean(); if (args.TryGetValue("viaTeleport",out tmpOSD))
viaTeleport = tmpOSD.AsBoolean();
Vector3 position = Vector3.Zero; Vector3 position = Vector3.Zero;
if (args.ContainsKey("position")) if (args.TryGetValue("position", out tmpOSD))
position = Vector3.Parse(args["position"].AsString()); position = Vector3.Parse(tmpOSD.AsString());
string agentHomeURI = null; string agentHomeURI = null;
if (args.ContainsKey("agent_home_uri")) if (args.TryGetValue("agent_home_uri", out tmpOSD))
agentHomeURI = args["agent_home_uri"].AsString(); agentHomeURI = tmpOSD.AsString();
// Decode the legacy (string) version and extract the number // Decode the legacy (string) version and extract the number
float theirVersion = 0f; float theirVersion = 0f;
if (args.ContainsKey("my_version")) if (args.TryGetValue("my_version", out tmpOSD))
{ {
string theirVersionStr = args["my_version"].AsString(); string theirVersionStr = tmpOSD.AsString();
string[] parts = theirVersionStr.Split(new char[] {'/'}); string[] parts = theirVersionStr.Split(new char[] {'/'});
if (parts.Length > 1) if (parts.Length > 1)
theirVersion = float.Parse(parts[1], Culture.FormatProvider); theirVersion = float.Parse(parts[1], Culture.FormatProvider);
} }
if (args.ContainsKey("context")) EntityTransferContext ctx = new EntityTransferContext();
ctx.Unpack((OSDMap)args["context"]); if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
ctx.Unpack((OSDMap)tmpOSD);
// Decode the new versioning data // Decode the new versioning data
float minVersionRequired = 0f; float minVersionRequired = 0f;
@ -168,15 +167,15 @@ namespace OpenSim.Server.Handlers.Simulation
float minVersionProvided = 0f; float minVersionProvided = 0f;
float maxVersionProvided = 0f; float maxVersionProvided = 0f;
if (args.ContainsKey("simulation_service_supported_min")) if (args.TryGetValue("simulation_service_supported_min", out tmpOSD))
minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); minVersionProvided = (float)tmpOSD.AsReal();
if (args.ContainsKey("simulation_service_supported_max")) if (args.TryGetValue("simulation_service_supported_max", out tmpOSD))
maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); maxVersionProvided = (float)tmpOSD.AsReal();
if (args.ContainsKey("simulation_service_accepted_min")) if (args.TryGetValue("simulation_service_accepted_min", out tmpOSD))
minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); minVersionRequired = (float)tmpOSD.AsReal();
if (args.ContainsKey("simulation_service_accepted_max")) if (args.TryGetValue("simulation_service_accepted_max", out tmpOSD))
maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); maxVersionRequired = (float)tmpOSD.AsReal();
responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["int_response_code"] = HttpStatusCode.OK;
OSDMap resp = new OSDMap(3); OSDMap resp = new OSDMap(3);
@ -239,9 +238,9 @@ namespace OpenSim.Server.Handlers.Simulation
List<UUID> features = new List<UUID>(); List<UUID> features = new List<UUID>();
if (args.ContainsKey("features")) if (args.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray)
{ {
OSDArray array = (OSDArray)args["features"]; OSDArray array = (OSDArray)tmpOSD;
foreach (OSD o in array) foreach (OSD o in array)
features.Add(new UUID(o.AsString())); features.Add(new UUID(o.AsString()));
@ -414,8 +413,6 @@ namespace OpenSim.Server.Handlers.Simulation
protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
{ {
EntityTransferContext ctx = new EntityTransferContext();
OSDMap args = Utils.GetOSDMap((string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null) if (args == null)
{ {
@ -424,8 +421,10 @@ namespace OpenSim.Server.Handlers.Simulation
return; return;
} }
if (args.ContainsKey("context")) OSD tmpOSD;
ctx.Unpack((OSDMap)args["context"]); EntityTransferContext ctx = new EntityTransferContext();
if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
ctx.Unpack((OSDMap)tmpOSD);
AgentDestinationData data = CreateAgentDestinationData(); AgentDestinationData data = CreateAgentDestinationData();
UnpackData(args, data, request); UnpackData(args, data, request);
@ -453,16 +452,19 @@ namespace OpenSim.Server.Handlers.Simulation
GridRegion source = null; GridRegion source = null;
if (args.ContainsKey("source_uuid")) if (args.TryGetValue("source_uuid", out tmpOSD))
{ {
source = new GridRegion(); source = new GridRegion();
source.RegionLocX = Int32.Parse(args["source_x"].AsString()); source.RegionID = UUID.Parse(tmpOSD.AsString());
source.RegionLocY = Int32.Parse(args["source_y"].AsString()); tmpOSD = args["source_x"];
source.RegionName = args["source_name"].AsString(); source.RegionLocX = Int32.Parse(tmpOSD.AsString());
source.RegionID = UUID.Parse(args["source_uuid"].AsString()); tmpOSD = args["source_y"];
source.RegionLocY = Int32.Parse(tmpOSD.AsString());
tmpOSD = args["source_name"];
source.RegionName = tmpOSD.AsString();
if (args.ContainsKey("source_server_uri")) if (args.TryGetValue("source_server_uri", out tmpOSD))
source.RawServerURI = args["source_server_uri"].AsString(); source.RawServerURI = tmpOSD.AsString();
else else
source.RawServerURI = null; source.RawServerURI = null;
} }
@ -493,21 +495,26 @@ namespace OpenSim.Server.Handlers.Simulation
protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request)
{ {
OSD tmpOSD;
// retrieve the input arguments // retrieve the input arguments
if (args.ContainsKey("destination_x") && args["destination_x"] != null) if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
Int32.TryParse(args["destination_x"].AsString(), out data.x); Int32.TryParse(tmpOSD.AsString(), out data.x);
else else
m_log.WarnFormat(" -- request didn't have destination_x"); m_log.WarnFormat(" -- request didn't have destination_x");
if (args.ContainsKey("destination_y") && args["destination_y"] != null)
Int32.TryParse(args["destination_y"].AsString(), out data.y); if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
Int32.TryParse(tmpOSD.AsString(), out data.y);
else else
m_log.WarnFormat(" -- request didn't have destination_y"); m_log.WarnFormat(" -- request didn't have destination_y");
if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
if (args.ContainsKey("destination_name") && args["destination_name"] != null) UUID.TryParse(tmpOSD.AsString(), out data.uuid);
data.name = args["destination_name"].ToString();
if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
data.flags = args["teleport_flags"].AsUInteger(); data.name = tmpOSD.ToString();
if (args.TryGetValue("teleport_flags", out tmpOSD) && tmpOSD != null)
data.flags = tmpOSD.AsUInteger();
} }
protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data)
@ -674,7 +681,6 @@ namespace OpenSim.Server.Handlers.Simulation
protected void DoAgentPut(Hashtable request, Hashtable responsedata) protected void DoAgentPut(Hashtable request, Hashtable responsedata)
{ {
// TODO: Encode the ENtityTransferContext // TODO: Encode the ENtityTransferContext
EntityTransferContext ctx = new EntityTransferContext();
OSDMap args = Utils.GetOSDMap((string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null) if (args == null)
@ -685,19 +691,21 @@ namespace OpenSim.Server.Handlers.Simulation
} }
// retrieve the input arguments // retrieve the input arguments
OSD tmpOSD;
EntityTransferContext ctx = new EntityTransferContext();
int x = 0, y = 0; int x = 0, y = 0;
UUID uuid = UUID.Zero; UUID uuid = UUID.Zero;
string regionname = string.Empty; string regionname = string.Empty;
if (args.ContainsKey("destination_x") && args["destination_x"] != null) if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
Int32.TryParse(args["destination_x"].AsString(), out x); Int32.TryParse(tmpOSD.AsString(), out x);
if (args.ContainsKey("destination_y") && args["destination_y"] != null) if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
Int32.TryParse(args["destination_y"].AsString(), out y); Int32.TryParse(tmpOSD.AsString(), out y);
if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
UUID.TryParse(args["destination_uuid"].AsString(), out uuid); UUID.TryParse(tmpOSD.AsString(), out uuid);
if (args.ContainsKey("destination_name") && args["destination_name"] != null) if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
regionname = args["destination_name"].ToString(); regionname = tmpOSD.ToString();
if (args.ContainsKey("context")) if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
ctx.Unpack((OSDMap)args["context"]); ctx.Unpack((OSDMap)tmpOSD);
GridRegion destination = new GridRegion(); GridRegion destination = new GridRegion();
destination.RegionID = uuid; destination.RegionID = uuid;

View File

@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.Simulation
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
OSD tmpOSD;
try try
{ {
OSDMap args = aCircuit.PackAgentCircuitData(ctx); OSDMap args = aCircuit.PackAgentCircuitData(ctx);
@ -120,27 +120,37 @@ namespace OpenSim.Services.Connectors.Simulation
PackData(args, source, aCircuit, destination, flags); PackData(args, source, aCircuit, destination, flags);
OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
bool success = result["success"].AsBoolean(); tmpOSD = result["success"];
if (success && result.ContainsKey("_Result")) bool success = tmpOSD.AsBoolean();
if (success && result.TryGetValue("_Result", out tmpOSD) && tmpOSD is OSDMap)
{ {
OSDMap data = (OSDMap)result["_Result"]; OSDMap data = (OSDMap)tmpOSD;
reason = data["reason"].AsString(); tmpOSD = data["reason"];
success = data["success"].AsBoolean(); reason = tmpOSD.AsString();
tmpOSD = data["success"];
success = tmpOSD.AsBoolean();
return success; return success;
} }
// Try the old version, uncompressed // Try the old version, uncompressed
result = WebUtil.PostToService(uri, args, 30000, false); result = WebUtil.PostToService(uri, args, 30000, false);
if (result["Success"].AsBoolean()) tmpOSD = result["success"];
success = tmpOSD.AsBoolean();
if (success)
{ {
if (result.ContainsKey("_Result")) if (result.TryGetValue("_Result", out tmpOSD) && tmpOSD is OSDMap)
{ {
OSDMap data = (OSDMap)result["_Result"]; OSDMap data = (OSDMap)tmpOSD;
tmpOSD = data["reason"];
reason = tmpOSD.AsString();
tmpOSD = data["success"];
success = tmpOSD.AsBoolean();
reason = data["reason"].AsString();
success = data["success"].AsBoolean();
m_log.WarnFormat( m_log.WarnFormat(
"[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName); "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName);
return success; return success;
@ -312,34 +322,47 @@ namespace OpenSim.Services.Connectors.Simulation
if (agentHomeURI != null) if (agentHomeURI != null)
request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
OSD tmpOSD;
try try
{ {
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false, true); OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false, true);
bool success = result["success"].AsBoolean();
if (result.ContainsKey("_Result")) tmpOSD = result["success"];
bool success = tmpOSD.AsBoolean();
bool has_Result = false;
if (result.TryGetValue("_Result", out tmpOSD))
{ {
OSDMap data = (OSDMap)result["_Result"]; has_Result = true;
OSDMap data = (OSDMap)tmpOSD;
// FIXME: If there is a _Result map then it's the success key here that indicates the true success // FIXME: If there is a _Result map then it's the success key here that indicates the true success
// or failure, not the sibling result node. // or failure, not the sibling result node.
success = data["success"].AsBoolean(); //nte4.8 crap
tmpOSD = data["success"];
success = tmpOSD.AsBoolean();
reason = data["reason"].AsString(); tmpOSD = data["reason"];
reason = tmpOSD.AsString();
// We will need to plumb this and start sing the outbound version as well // We will need to plumb this and start sing the outbound version as well
// TODO: lay the pipe for version plumbing // TODO: lay the pipe for version plumbing
if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null) if (data.TryGetValue("negotiated_inbound_version", out tmpOSD) && tmpOSD != null)
{ {
ctx.InboundVersion = (float)data["negotiated_inbound_version"].AsReal(); ctx.InboundVersion = (float)tmpOSD.AsReal();
ctx.OutboundVersion = (float)data["negotiated_outbound_version"].AsReal(); tmpOSD = data["negotiated_outbound_version"];
ctx.OutboundVersion = (float)tmpOSD.AsReal();
} }
else if (data["version"] != null && data["version"].AsString() != string.Empty) else if (data.TryGetValue("version", out tmpOSD) && tmpOSD != null)
{ {
string versionString = data["version"].AsString(); string versionString = tmpOSD.AsString();
String[] parts = versionString.Split(new char[] {'/'}); if(versionString != string.Empty)
if (parts.Length > 1)
{ {
ctx.InboundVersion = float.Parse(parts[1], Culture.FormatProvider); String[] parts = versionString.Split(new char[] {'/'});
ctx.OutboundVersion = float.Parse(parts[1], Culture.FormatProvider); if (parts.Length > 1)
{
ctx.InboundVersion = float.Parse(parts[1], Culture.FormatProvider);
ctx.OutboundVersion = float.Parse(parts[1], Culture.FormatProvider);
}
} }
} }
@ -352,11 +375,11 @@ namespace OpenSim.Services.Connectors.Simulation
{ {
// If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the
// actual failure message // actual failure message
if (!result.ContainsKey("_Result")) if (!has_Result)
{ {
if (result.ContainsKey("Message")) if (result.TryGetValue("Message", out tmpOSD))
{ {
string message = result["Message"].AsString(); string message = tmpOSD.AsString();
if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
{ {
m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
@ -376,9 +399,9 @@ namespace OpenSim.Services.Connectors.Simulation
featuresAvailable.Clear(); featuresAvailable.Clear();
if (result.ContainsKey("features")) if (result.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray)
{ {
OSDArray array = (OSDArray)result["features"]; OSDArray array = (OSDArray)tmpOSD;
foreach (OSD o in array) foreach (OSD o in array)
featuresAvailable.Add(new UUID(o.AsString())); featuresAvailable.Add(new UUID(o.AsString()));