mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
waste some memory on serialized environment caching. we could live without all that locking
This commit is contained in:
@@ -470,15 +470,15 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
|
||||
if(sp != null && sp.Environment != null)
|
||||
{
|
||||
if (parcelid == -1)
|
||||
//if (parcelid == -1)
|
||||
VEnv = sp.Environment;
|
||||
else
|
||||
{
|
||||
OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcelid);
|
||||
httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlToBytes(def);
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
return;
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcelid);
|
||||
// httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlToBytes(def);
|
||||
// httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
else if (parcelid == -1)
|
||||
VEnv = GetRegionEnvironment();
|
||||
@@ -499,17 +499,19 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
}
|
||||
}
|
||||
|
||||
OSDMap map = new OSDMap();
|
||||
OSDMap cenv = (OSDMap)VEnv.ToOSD();
|
||||
cenv["parcel_id"] = parcelid;
|
||||
cenv["region_id"] = regionID;
|
||||
map["environment"] = cenv;
|
||||
map["parcel_id"] = parcelid;
|
||||
map["success"] = true;
|
||||
//OSDMap map = new OSDMap();
|
||||
//OSDMap cenv = (OSDMap)VEnv.ToOSD();
|
||||
//cenv["parcel_id"] = parcelid;
|
||||
//cenv["region_id"] = regionID;
|
||||
//map["environment"] = cenv;
|
||||
//map["parcel_id"] = parcelid;
|
||||
//map["success"] = true;
|
||||
|
||||
string env = OSDParser.SerializeLLSDXmlString(map);
|
||||
//string env = OSDParser.SerializeLLSDXmlString(map);
|
||||
|
||||
if (String.IsNullOrEmpty(env))
|
||||
//if (String.IsNullOrEmpty(env))
|
||||
byte[] envBytes = VEnv.ToCapBytes(regionID, parcelid);
|
||||
if(envBytes == null)
|
||||
{
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
LLSDxmlEncode.AddArray(sb);
|
||||
@@ -518,10 +520,11 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
LLSDxmlEncode.AddElem("regionID", regionID, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
env = LLSDxmlEncode.End(sb);
|
||||
httpResponse.RawBuffer = LLSDxmlEncode.EndToNBBytes(sb);
|
||||
}
|
||||
else
|
||||
httpResponse.RawBuffer = envBytes;
|
||||
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(env);
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
@@ -719,10 +722,12 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
VEnv = GetRegionEnvironment();
|
||||
}
|
||||
|
||||
OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
|
||||
string env = OSDParser.SerializeLLSDXmlString(d);
|
||||
//OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
|
||||
//string env = OSDParser.SerializeLLSDXmlString(d);
|
||||
|
||||
if (String.IsNullOrEmpty(env))
|
||||
//if (String.IsNullOrEmpty(env))
|
||||
byte[] envBytes = VEnv.ToCapWLBytes(UUID.Zero, regionID);
|
||||
if(envBytes == null)
|
||||
{
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
LLSDxmlEncode.AddArray(sb);
|
||||
@@ -731,10 +736,11 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
LLSDxmlEncode.AddElem("regionID", regionID, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
env = LLSDxmlEncode.End(sb);
|
||||
response.RawBuffer = LLSDxmlEncode.EndToNBBytes(sb);
|
||||
}
|
||||
else
|
||||
response.RawBuffer = envBytes;
|
||||
|
||||
response.RawBuffer = Util.UTF8NBGetbytes(env);
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user