Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

cpu-performance
Diva Canto 2013-06-12 17:48:48 -07:00
commit b271217084
15 changed files with 229 additions and 124 deletions

View File

@ -457,8 +457,6 @@ namespace OpenSim.Data.MySQL
if (prim.ParentUUID == UUID.Zero) if (prim.ParentUUID == UUID.Zero)
{ {
objects[prim.UUID] = new SceneObjectGroup(prim); objects[prim.UUID] = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
} }
} }

View File

@ -732,11 +732,12 @@ namespace OpenSim.Data.SQLite
} }
SceneObjectGroup group = new SceneObjectGroup(prim); SceneObjectGroup group = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(group);
createdObjects.Add(group.UUID, group); createdObjects.Add(group.UUID, group);
retvals.Add(group); retvals.Add(group);
LoadItems(prim); LoadItems(prim);
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -125,11 +125,10 @@ namespace OpenSim.Framework
Animation other = obj as Animation; Animation other = obj as Animation;
if (other != null) if (other != null)
{ {
return (other.AnimID == this.AnimID return (other.AnimID.Equals(this.AnimID)
&& other.SequenceNum == this.SequenceNum && other.SequenceNum == this.SequenceNum
&& other.ObjectID == this.ObjectID); && other.ObjectID.Equals(this.ObjectID) );
} }
return base.Equals(obj); return base.Equals(obj);
} }

View File

@ -121,12 +121,14 @@ namespace OpenSim.Framework.Servers
+ " level >= 2 then long warnings are logged when receiving bad input data.\n" + " level >= 2 then long warnings are logged when receiving bad input data.\n"
+ " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
+ " level >= 4 then the time taken to fulfill the request is logged.\n" + " level >= 4 then the time taken to fulfill the request is logged.\n"
+ " level >= 5 then a sample from the beginning of the incoming data is logged.\n" + " level >= 5 then a sample from the beginning of the data is logged.\n"
+ " level >= 6 then the entire incoming data is logged.\n" + " level >= 6 then the entire data is logged.\n"
+ " no level is specified then the current level is returned.\n\n" + " no level is specified then the current level is returned.\n\n"
+ "If out or all and\n" + "If out or all and\n"
+ " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n" + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
+ " level >= 4 then the time taken to fulfill the request is logged.\n", + " level >= 4 then the time taken to fulfill the request is logged.\n"
+ " level >= 5 then a sample from the beginning of the data is logged.\n"
+ " level >= 6 then the entire data is logged.\n",
HandleDebugHttpCommand); HandleDebugHttpCommand);
} }

View File

@ -151,6 +151,39 @@ namespace OpenSim.Framework
} }
} }
public static void LogOutgoingDetail(Stream outputStream)
{
using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8))
{
string output;
if (DebugLevel == 5)
{
const int sampleLength = 80;
char[] sampleChars = new char[sampleLength];
reader.Read(sampleChars, 0, sampleLength);
output = new string(sampleChars);
}
else
{
output = reader.ReadToEnd();
}
LogOutgoingDetail(output);
}
}
public static void LogOutgoingDetail(string output)
{
if (DebugLevel == 5)
{
output = output.Substring(0, 80);
output = output + "...";
}
m_log.DebugFormat("[WEB UTIL]: {0}", output.Replace("\n", @"\n"));
}
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
{ {
int reqnum = RequestNumber++; int reqnum = RequestNumber++;
@ -179,6 +212,10 @@ namespace OpenSim.Framework
if (data != null) if (data != null)
{ {
strBuffer = OSDParser.SerializeJsonString(data); strBuffer = OSDParser.SerializeJsonString(data);
if (DebugLevel >= 5)
LogOutgoingDetail(strBuffer);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
if (compressed) if (compressed)
@ -357,6 +394,10 @@ namespace OpenSim.Framework
if (data != null) if (data != null)
{ {
queryString = BuildQueryString(data); queryString = BuildQueryString(data);
if (DebugLevel >= 5)
LogOutgoingDetail(queryString);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
request.ContentLength = buffer.Length; request.ContentLength = buffer.Length;
@ -767,6 +808,9 @@ namespace OpenSim.Framework
int length = (int)buffer.Length; int length = (int)buffer.Length;
request.ContentLength = length; request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
request.BeginGetRequestStream(delegate(IAsyncResult res) request.BeginGetRequestStream(delegate(IAsyncResult res)
{ {
Stream requestStream = request.EndGetRequestStream(res); Stream requestStream = request.EndGetRequestStream(res);
@ -954,6 +998,9 @@ namespace OpenSim.Framework
length = (int)obj.Length; length = (int)obj.Length;
request.ContentLength = length; request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
Stream requestStream = null; Stream requestStream = null;
try try
{ {
@ -1096,6 +1143,9 @@ namespace OpenSim.Framework
int length = (int)buffer.Length; int length = (int)buffer.Length;
request.ContentLength = length; request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
Stream requestStream = null; Stream requestStream = null;
try try
{ {

View File

@ -42,7 +42,7 @@ using OpenSim.Tests.Common;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
{ {
[TestFixture] [TestFixture]
public class AssetConnectorsTests : OpenSimTestCase public class AssetConnectorTests : OpenSimTestCase
{ {
[Test] [Test]
public void TestAddAsset() public void TestAddAsset()
@ -77,7 +77,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
[Test]
public void TestAddTemporaryAsset() public void TestAddTemporaryAsset()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
@ -93,34 +92,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config); lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// If it is remote, it should be stored // If it is remote, it should be stored
// AssetBase a2 = AssetHelpers.CreateNotecardAsset(); AssetBase a2 = AssetHelpers.CreateNotecardAsset();
// a2.Local = false; a2.Local = false;
// a2.Temporary = true; a2.Temporary = true;
// lasc.Store(a2); lasc.Store(a2);
// AssetBase retreivedA2 = lasc.Get(a2.ID); AssetBase retreivedA2 = lasc.Get(a2.ID);
// Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
// Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
// Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
// AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
// Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
// byte[] retrievedA2Data = lasc.GetData(a2.ID); byte[] retrievedA2Data = lasc.GetData(a2.ID);
// Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
@ -152,5 +140,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
[Test]
public void TestAddTemporaryLocalAsset()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
config.AddConfig("AssetService");
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// TODO: Add cache and check that this does receive a copy of the asset
}
} }
} }

View File

@ -312,18 +312,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
buff.Append("dflt="); buff.Append("dflt=");
buff.Append(DefaultAnimation.ToString()); buff.Append(DefaultAnimation.ToString());
buff.Append(",iDflt="); buff.Append(",iDflt=");
if (DefaultAnimation == ImplicitDefaultAnimation) if (DefaultAnimation.Equals(ImplicitDefaultAnimation))
buff.Append("same"); buff.Append("same");
else else
buff.Append(ImplicitDefaultAnimation.ToString()); buff.Append(ImplicitDefaultAnimation.ToString());
if (m_animations.Count > 0) if (m_animations.Count > 0)
{ {
buff.Append(",anims="); buff.Append(",anims=");
bool firstTime = true;
foreach (OpenSim.Framework.Animation anim in m_animations) foreach (OpenSim.Framework.Animation anim in m_animations)
{ {
if (!firstTime)
buff.Append(",");
buff.Append("<"); buff.Append("<");
buff.Append(anim.ToString()); buff.Append(anim.ToString());
buff.Append(">,"); buff.Append(">");
firstTime = false;
} }
} }
return buff.ToString(); return buff.ToString();

View File

@ -94,6 +94,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
{ {
SendAnimPack(); SendAnimPack();
m_scenePresence.TriggerScenePresenceUpdated();
} }
} }
@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_animations.Remove(animID, allowNoDefault)) if (m_animations.Remove(animID, allowNoDefault))
{ {
SendAnimPack(); SendAnimPack();
m_scenePresence.TriggerScenePresenceUpdated();
} }
} }

View File

@ -763,6 +763,11 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
if (part.KeyframeMotion != null)
{
part.KeyframeMotion.UpdateSceneObject(this);
}
if (Object.ReferenceEquals(part, m_rootPart)) if (Object.ReferenceEquals(part, m_rootPart))
continue; continue;

View File

@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
// } // }
private void TriggerScenePresenceUpdated() public void TriggerScenePresenceUpdated()
{ {
if (m_scene != null) if (m_scene != null)
m_scene.EventManager.TriggerScenePresenceUpdated(this); m_scene.EventManager.TriggerScenePresenceUpdated(this);

View File

@ -168,10 +168,10 @@ public abstract class BSShape
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{ {
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. prim={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,prim={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
} }
else else
{ {
@ -238,17 +238,17 @@ public abstract class BSShape
{ {
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{ {
physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. prim={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,prim={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
} }
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing) if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing)
{ {
physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}", physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. prim={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}", physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,prim={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
} }
} }
} }
@ -260,6 +260,19 @@ public abstract class BSShape
return fillShape.physShapeInfo; return fillShape.physShapeInfo;
} }
public static String UsefulPrimInfo(BSScene pScene, BSPhysObject prim)
{
StringBuilder buff = new StringBuilder(prim.PhysObjectName);
buff.Append("/pos=");
buff.Append(prim.RawPosition.ToString());
if (pScene != null)
{
buff.Append("/rgn=");
buff.Append(pScene.Name);
}
return buff.ToString();
}
#endregion // Common shape routines #endregion // Common shape routines
} }
@ -528,8 +541,7 @@ public class BSShapeMesh : BSShape
{ {
// Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh. // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh.
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim={1}", LogHeader, UsefulPrimInfo(physicsScene, prim) );
LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name);
physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey);
} }
} }

View File

@ -1,5 +1,9 @@
CURRENT PROBLEMS TO FIX AND/OR LOOK AT CURRENT PROBLEMS TO FIX AND/OR LOOK AT
================================================= =================================================
Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass.
Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive?
Negative buoyancy computed correctly
Computation of mesh mass. How done? How should it be done?
Script changing rotation of child prim while vehicle moving (eg turning wheel) causes Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
the wheel to appear to jump back. Looks like sending position from previous update. the wheel to appear to jump back. Looks like sending position from previous update.
Enable vehicle border crossings (at least as poorly as ODE) Enable vehicle border crossings (at least as poorly as ODE)

View File

@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
} }
return FailureResult(); return FailureResult();

View File

@ -84,6 +84,30 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
} }
private bool CheckReturn(Dictionary<string, object> ret)
{
if (ret == null)
return false;
if (ret.Count == 0)
return false;
if (ret.ContainsKey("RESULT"))
{
if (ret["RESULT"] is string)
{
bool result;
if (bool.TryParse((string)ret["RESULT"], out result))
return result;
return false;
}
}
return true;
}
public bool CreateUserInventory(UUID principalID) public bool CreateUserInventory(UUID principalID)
{ {
Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY", Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY",
@ -91,12 +115,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() } { "PRINCIPAL", principalID.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
if (ret.Count == 0)
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
@ -106,9 +125,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() } { "PRINCIPAL", principalID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
@ -135,9 +152,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() } { "PRINCIPAL", principalID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]); return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -151,9 +166,7 @@ namespace OpenSim.Services.Connectors
{ "TYPE", ((int)type).ToString() } { "TYPE", ((int)type).ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]); return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -174,9 +187,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDER", folderID.ToString() } { "FOLDER", folderID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
Dictionary<string,object> folders = Dictionary<string,object> folders =
@ -205,9 +216,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDER", folderID.ToString() } { "FOLDER", folderID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"];
@ -230,10 +239,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() } { "ID", folder.ID.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool UpdateFolder(InventoryFolderBase folder) public bool UpdateFolder(InventoryFolderBase folder)
@ -248,10 +254,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() } { "ID", folder.ID.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool MoveFolder(InventoryFolderBase folder) public bool MoveFolder(InventoryFolderBase folder)
@ -263,10 +266,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", folder.Owner.ToString() } { "PRINCIPAL", folder.Owner.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) public bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
@ -282,10 +282,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDERS", slist } { "FOLDERS", slist }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool PurgeFolder(InventoryFolderBase folder) public bool PurgeFolder(InventoryFolderBase folder)
@ -295,10 +292,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() } { "ID", folder.ID.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
@ -330,10 +324,7 @@ namespace OpenSim.Services.Connectors
{ "CreationDate", item.CreationDate.ToString() } { "CreationDate", item.CreationDate.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool UpdateItem(InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)
@ -365,10 +356,7 @@ namespace OpenSim.Services.Connectors
{ "CreationDate", item.CreationDate.ToString() } { "CreationDate", item.CreationDate.ToString() }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool MoveItems(UUID principalID, List<InventoryItemBase> items) public bool MoveItems(UUID principalID, List<InventoryItemBase> items)
@ -389,10 +377,7 @@ namespace OpenSim.Services.Connectors
{ "DESTLIST", destlist } { "DESTLIST", destlist }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public bool DeleteItems(UUID principalID, List<UUID> itemIDs) public bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@ -408,10 +393,7 @@ namespace OpenSim.Services.Connectors
{ "ITEMS", slist } { "ITEMS", slist }
}); });
if (ret == null) return CheckReturn(ret);
return false;
return bool.Parse(ret["RESULT"].ToString());
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(InventoryItemBase item)
@ -423,9 +405,7 @@ namespace OpenSim.Services.Connectors
{ "ID", item.ID.ToString() } { "ID", item.ID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
return BuildItem((Dictionary<string, object>)ret["item"]); return BuildItem((Dictionary<string, object>)ret["item"]);
@ -447,9 +427,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() } { "ID", folder.ID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]); return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -469,7 +447,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() } { "PRINCIPAL", principalID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null; return null;
List<InventoryItemBase> items = new List<InventoryItemBase>(); List<InventoryItemBase> items = new List<InventoryItemBase>();
@ -488,10 +466,22 @@ namespace OpenSim.Services.Connectors
{ "ASSET", assetID.ToString() } { "ASSET", assetID.ToString() }
}); });
// We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int
if (ret == null) if (ret == null)
return 0; return 0;
return int.Parse(ret["RESULT"].ToString()); if (ret.ContainsKey("RESULT"))
{
if (ret["RESULT"] is string)
{
int intResult;
if (int.TryParse ((string)ret["RESULT"], out intResult))
return intResult;
}
}
return 0;
} }
public InventoryCollection GetUserInventory(UUID principalID) public InventoryCollection GetUserInventory(UUID principalID)
@ -508,9 +498,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() } { "PRINCIPAL", principalID.ToString() }
}); });
if (ret == null) if (!CheckReturn(ret))
return null;
if (ret.Count == 0)
return null; return null;
Dictionary<string, object> folders = Dictionary<string, object> folders =

View File

@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService
{ {
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for inventory skeleton", principalID);
return null;
}
List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID);
if (tree == null || (tree != null && tree.Count == 0)) if (tree == null || (tree != null && tree.Count == 0))
return null; return null;
@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService
public override InventoryCollection GetUserInventory(UUID userID) public override InventoryCollection GetUserInventory(UUID userID)
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID);
InventoryCollection userInventory = new InventoryCollection(); InventoryCollection userInventory = new InventoryCollection();
userInventory.UserID = userID; userInventory.UserID = userID;
userInventory.Folders = new List<InventoryFolderBase>(); userInventory.Folders = new List<InventoryFolderBase>();
@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService
XInventoryFolder suitcase = GetSuitcaseXFolder(userID); XInventoryFolder suitcase = GetSuitcaseXFolder(userID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID);
return null;
}
List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID);
if (tree == null || (tree != null && tree.Count == 0)) if (tree == null || (tree != null && tree.Count == 0))
{ {
@ -182,7 +195,8 @@ namespace OpenSim.Services.HypergridService
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID);
// Let's find out the local root folder // Let's find out the local root folder
XInventoryFolder root = GetRootXFolder(principalID); ; XInventoryFolder root = GetRootXFolder(principalID);
if (root == null) if (root == null)
{ {
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID);
@ -255,6 +269,13 @@ namespace OpenSim.Services.HypergridService
{ {
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type);
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for child type folder {1}", principalID, type);
return null;
}
XInventoryFolder[] folders = m_Database.GetFolders( XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "type", "parentFolderID" }, new string[] { "agentID", "type", "parentFolderID" },
new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() });
@ -546,6 +567,7 @@ namespace OpenSim.Services.HypergridService
private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID)
{ {
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null) if (suitcase == null)
{ {
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID);