From 135e10ba09a527d14a2fea0c6398757ce450c9fa Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 11 Jun 2013 23:55:45 +0100 Subject: [PATCH 1/9] Uncomment Mic's code and split to create new regression TestAddTemporaryAsset() and TestAddTemporaryLocalAsset() --- .../Asset/Tests/AssetConnectorTests.cs | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs index 7073433129..4f75191cf2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs @@ -42,7 +42,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests { [TestFixture] - public class AssetConnectorsTests : OpenSimTestCase + public class AssetConnectorTests : OpenSimTestCase { [Test] 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 } - [Test] public void TestAddTemporaryAsset() { TestHelpers.InMethod(); @@ -93,34 +92,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests 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); - // If it is remote, it should be stored - // AssetBase a2 = AssetHelpers.CreateNotecardAsset(); - // a2.Local = false; - // a2.Temporary = true; + AssetBase a2 = AssetHelpers.CreateNotecardAsset(); + a2.Local = false; + a2.Temporary = true; - // lasc.Store(a2); + lasc.Store(a2); - // AssetBase retreivedA2 = lasc.Get(a2.ID); - // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); - // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); - // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); + AssetBase retreivedA2 = lasc.Get(a2.ID); + Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); + Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); + Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); - // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); - // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); + AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); + Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); - // byte[] retrievedA2Data = lasc.GetData(a2.ID); - // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); + byte[] retrievedA2Data = lasc.GetData(a2.ID); + Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); // 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 } + + [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 + } } } \ No newline at end of file From 7556a0f699f8474b7ac23cbebacc695c93f374fa Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Jun 2013 17:18:12 -0700 Subject: [PATCH 2/9] Add TriggerScenePresenceUpdated events when an animation is added or removed. Shouldn't impact anyone as only DSG seems to use OnScenePresenceUpdated event. Some minor format changes to AnimationSet's ToString(). --- OpenSim/Framework/Animation.cs | 5 ++--- OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 8 ++++++-- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 ++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index 8bdf8f4373..34255058ca 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs @@ -125,11 +125,10 @@ namespace OpenSim.Framework Animation other = obj as Animation; if (other != null) { - return (other.AnimID == this.AnimID + return (other.AnimID.Equals(this.AnimID) && other.SequenceNum == this.SequenceNum - && other.ObjectID == this.ObjectID); + && other.ObjectID.Equals(this.ObjectID) ); } - return base.Equals(obj); } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 5dee64d0b5..b7400ea8ca 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -312,18 +312,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation buff.Append("dflt="); buff.Append(DefaultAnimation.ToString()); buff.Append(",iDflt="); - if (DefaultAnimation == ImplicitDefaultAnimation) + if (DefaultAnimation.Equals(ImplicitDefaultAnimation)) buff.Append("same"); else buff.Append(ImplicitDefaultAnimation.ToString()); if (m_animations.Count > 0) { buff.Append(",anims="); + bool firstTime = true; foreach (OpenSim.Framework.Animation anim in m_animations) { + if (!firstTime) + buff.Append(","); buff.Append("<"); buff.Append(anim.ToString()); - buff.Append(">,"); + buff.Append(">"); + firstTime = false; } } return buff.ToString(); diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index a701a79081..3b5a5bd6f2 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) { SendAnimPack(); + m_scenePresence.TriggerScenePresenceUpdated(); } } @@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_animations.Remove(animID, allowNoDefault)) { SendAnimPack(); + m_scenePresence.TriggerScenePresenceUpdated(); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bab14dd3de..774546c693 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); // } - private void TriggerScenePresenceUpdated() + public void TriggerScenePresenceUpdated() { if (m_scene != null) m_scene.EventManager.TriggerScenePresenceUpdated(this); From 90097de6c3cf58989698b37c89baa8268895fc86 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 11 Jun 2013 20:35:25 -0400 Subject: [PATCH 3/9] Add option to set minimum fee for classified ads Upcoming phoenix-firestorm (4.4.1) adds a configurable option for setting the minimum price for publishing a classified ad. http://hg.phoenixviewer.com/phoenix-firestorm-lgpl/rev/43415d69b048 --- bin/Robust.HG.ini.example | 8 +++++++- bin/Robust.ini.example | 6 ++++++ bin/config-include/StandaloneCommon.ini.example | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index d9f1ca1725..2afb978469 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -1,4 +1,4 @@ -; * Run +i * Run ; * $ Robust.exe -inifile Robust.HG.ini ; * @@ -311,6 +311,9 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ;; Ask co-operative viewers to use a different currency name ;Currency = "" + ;; Minimum fee for creation of classified + ; ClassifiedFee = 0 + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" @@ -436,6 +439,9 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ; this is the entry point for all user-related HG services ; uas = http://127.0.0.1:8002/ + ;; Minimum fee to publish classified add + ; ClassifiedFee = 0 + [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" ;; for the service diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 7d6492bf94..34401918e2 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -274,6 +274,9 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; Ask co-operative viewers to use a different currency name ;Currency = "" + ;; Minimum fee for creation of classified + ; ClassifiedFee = 0 + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" @@ -393,6 +396,9 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; password help: optional: page providing password assistance for users of your grid ;password = http://127.0.0.1/password + ;; Minimum fee to publish classified add + ; ClassifiedFee = 0 + [UserProfilesService] LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" Enabled = false diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 8c23c41418..8ec3daf45c 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -222,6 +222,9 @@ ; this is the entry point for all user-related HG services ; uas = http://127.0.0.1:9000/ + ;; Minimum fee to publish classified add + ; ClassifiedFee = 0 + [MapImageService] ; Set this if you want to change the default ; TilesStoragePath = "maptiles" From 3cb65f0d3166f976713a7c095eb37e6de05061d0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Jun 2013 17:58:08 -0700 Subject: [PATCH 4/9] BulletSim: when meshing or asset fetching fails, include position and region with the offending object's name in the error message. --- .../Region/Physics/BulletSPlugin/BSShapes.cs | 40 ++++++++++++------- .../Physics/BulletSPlugin/BulletSimTODO.txt | 4 ++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 202a4ce0ee..006a9c17f2 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -168,10 +168,10 @@ public abstract class BSShape if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) { prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; - physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } else { @@ -238,17 +238,17 @@ public abstract class BSShape { if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { - physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing) { - physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } } } @@ -260,6 +260,19 @@ public abstract class BSShape 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 } @@ -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. prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; - physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", - LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); + physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim={1}", LogHeader, UsefulPrimInfo(physicsScene, prim) ); physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 1e015263da..4357ef15f6 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -1,5 +1,9 @@ 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 the wheel to appear to jump back. Looks like sending position from previous update. Enable vehicle border crossings (at least as poorly as ODE) From 9fec0faade3979fc6e514b4acde92741aa0e9c16 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 11 Jun 2013 21:46:40 -0400 Subject: [PATCH 5/9] Revert "Add option to set minimum fee for classified ads" This reverts commit 90097de6c3cf58989698b37c89baa8268895fc86. --- bin/Robust.HG.ini.example | 8 +------- bin/Robust.ini.example | 6 ------ bin/config-include/StandaloneCommon.ini.example | 3 --- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 2afb978469..d9f1ca1725 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -1,4 +1,4 @@ -i * Run +; * Run ; * $ Robust.exe -inifile Robust.HG.ini ; * @@ -311,9 +311,6 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ;; Ask co-operative viewers to use a different currency name ;Currency = "" - ;; Minimum fee for creation of classified - ; ClassifiedFee = 0 - WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" @@ -439,9 +436,6 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ; this is the entry point for all user-related HG services ; uas = http://127.0.0.1:8002/ - ;; Minimum fee to publish classified add - ; ClassifiedFee = 0 - [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" ;; for the service diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 34401918e2..7d6492bf94 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -274,9 +274,6 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; Ask co-operative viewers to use a different currency name ;Currency = "" - ;; Minimum fee for creation of classified - ; ClassifiedFee = 0 - WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" @@ -396,9 +393,6 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; password help: optional: page providing password assistance for users of your grid ;password = http://127.0.0.1/password - ;; Minimum fee to publish classified add - ; ClassifiedFee = 0 - [UserProfilesService] LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" Enabled = false diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 8ec3daf45c..8c23c41418 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -222,9 +222,6 @@ ; this is the entry point for all user-related HG services ; uas = http://127.0.0.1:9000/ - ;; Minimum fee to publish classified add - ; ClassifiedFee = 0 - [MapImageService] ; Set this if you want to change the default ; TilesStoragePath = "maptiles" From 47b6e78790be5a4b7d8a0f4c860f1e2f6f87b137 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 12 Jun 2013 21:34:20 +0100 Subject: [PATCH 6/9] Implement logging of first 80 characters (debug level 5) or full body data (debug level 6) on outgoing requests, depending on debug level This is set via "debug http out " This matches the existing debug level behaviours for logging incoming http data --- OpenSim/Framework/Servers/MainServer.cs | 8 ++-- OpenSim/Framework/WebUtil.cs | 54 ++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index cfd34bb5b4..d189580677 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -121,12 +121,14 @@ namespace OpenSim.Framework.Servers + " 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 >= 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 >= 6 then the entire incoming data 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" + " no level is specified then the current level is returned.\n\n" + "If out or all and\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); } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 701fbb0280..4599f62001 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -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) { int reqnum = RequestNumber++; @@ -178,7 +211,11 @@ namespace OpenSim.Framework // If there is some input, write it into the request if (data != null) { - strBuffer = OSDParser.SerializeJsonString(data); + strBuffer = OSDParser.SerializeJsonString(data); + + if (DebugLevel >= 5) + LogOutgoingDetail(strBuffer); + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); if (compressed) @@ -357,6 +394,10 @@ namespace OpenSim.Framework if (data != null) { queryString = BuildQueryString(data); + + if (DebugLevel >= 5) + LogOutgoingDetail(queryString); + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); request.ContentLength = buffer.Length; @@ -767,6 +808,9 @@ namespace OpenSim.Framework int length = (int)buffer.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + request.BeginGetRequestStream(delegate(IAsyncResult res) { Stream requestStream = request.EndGetRequestStream(res); @@ -954,6 +998,9 @@ namespace OpenSim.Framework length = (int)obj.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + Stream requestStream = null; try { @@ -1096,6 +1143,9 @@ namespace OpenSim.Framework int length = (int)buffer.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + Stream requestStream = null; try { @@ -1198,4 +1248,4 @@ namespace OpenSim.Framework return deserial; } } -} +} \ No newline at end of file From 824a4b480873721a4a10598299b185b602e1931d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 12 Jun 2013 23:47:47 +0100 Subject: [PATCH 7/9] After calls to GetSuitcaseXFolder() in HGSuitcaseInventoryService, consistently check for null return and log warning rather than throw exception. This was being done already in some places. If an exception is thrown it is now an error rather than debug --- .../Inventory/XInventoryInConnector.cs | 2 +- .../HGSuitcaseInventoryService.cs | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 64127c20af..9d28dc3c6d 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset } catch (Exception e) { - m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); + m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); } return FailureResult(); diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index eecf7579e5..410916f5c5 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService { 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 tree = GetFolderTree(principalID, suitcase.folderID); if (tree == null || (tree != null && tree.Count == 0)) return null; @@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService public override InventoryCollection GetUserInventory(UUID userID) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); + InventoryCollection userInventory = new InventoryCollection(); userInventory.UserID = userID; userInventory.Folders = new List(); @@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService 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 tree = GetFolderTree(userID, suitcase.folderID); 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); // Let's find out the local root folder - XInventoryFolder root = GetRootXFolder(principalID); ; + XInventoryFolder root = GetRootXFolder(principalID); + if (root == null) { 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); 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( new string[] { "agentID", "type", "parentFolderID" }, 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) { XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); + if (suitcase == null) { m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); From 33573003620674f4a4f6c8fadd969c7aa6576a5d Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 12 Jun 2013 18:13:00 -0500 Subject: [PATCH 8/9] * This fixes having to select and deselect prim to get keyframemotion to start running when pulled from data storage. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 2 -- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 5 +++-- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 448962ae13..de52623459 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -457,8 +457,6 @@ namespace OpenSim.Data.MySQL if (prim.ParentUUID == UUID.Zero) { objects[prim.UUID] = new SceneObjectGroup(prim); - if (prim.KeyframeMotion != null) - prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); } } diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 70b76c9186..c35bba2965 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -732,11 +732,12 @@ namespace OpenSim.Data.SQLite } SceneObjectGroup group = new SceneObjectGroup(prim); - if (prim.KeyframeMotion != null) - prim.KeyframeMotion.UpdateSceneObject(group); + createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); + + } } catch (Exception e) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index da80e4f627..7b5fdcb559 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -763,6 +763,11 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; + if (part.KeyframeMotion != null) + { + part.KeyframeMotion.UpdateSceneObject(this); + } + if (Object.ReferenceEquals(part, m_rootPart)) continue; From 7759b05dcb39298c0b47da827eda7250db5c2c83 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 13 Jun 2013 00:31:32 +0100 Subject: [PATCH 9/9] Make XInventoryServicesConnector properly handle a RESULT = false return for methods where this contains failure rather than throwing an exception. Result = False is generated for methods such as GetFolderForType() when the other end wants to signal a failure of the operation in methods such as GetFolderForType() --- .../Inventory/XInventoryServicesConnector.cs | 124 ++++++++---------- 1 file changed, 56 insertions(+), 68 deletions(-) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 44f5e0180c..36d4ae25f0 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -84,6 +84,30 @@ namespace OpenSim.Services.Connectors m_ServerURI = serviceURI; } + private bool CheckReturn(Dictionary 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) { Dictionary ret = MakeRequest("CREATEUSERINVENTORY", @@ -91,12 +115,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return false; - if (ret.Count == 0) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public List GetInventorySkeleton(UUID principalID) @@ -106,9 +125,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders = (Dictionary)ret["FOLDERS"]; @@ -135,9 +152,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -151,9 +166,7 @@ namespace OpenSim.Services.Connectors { "TYPE", ((int)type).ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -174,9 +187,7 @@ namespace OpenSim.Services.Connectors { "FOLDER", folderID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders = @@ -205,9 +216,7 @@ namespace OpenSim.Services.Connectors { "FOLDER", folderID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary items = (Dictionary)ret["ITEMS"]; @@ -230,10 +239,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool UpdateFolder(InventoryFolderBase folder) @@ -248,10 +254,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool MoveFolder(InventoryFolderBase folder) @@ -263,10 +266,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", folder.Owner.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool DeleteFolders(UUID principalID, List folderIDs) @@ -282,10 +282,7 @@ namespace OpenSim.Services.Connectors { "FOLDERS", slist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool PurgeFolder(InventoryFolderBase folder) @@ -295,10 +292,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool AddItem(InventoryItemBase item) @@ -330,10 +324,7 @@ namespace OpenSim.Services.Connectors { "CreationDate", item.CreationDate.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool UpdateItem(InventoryItemBase item) @@ -365,10 +356,7 @@ namespace OpenSim.Services.Connectors { "CreationDate", item.CreationDate.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool MoveItems(UUID principalID, List items) @@ -389,10 +377,7 @@ namespace OpenSim.Services.Connectors { "DESTLIST", destlist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool DeleteItems(UUID principalID, List itemIDs) @@ -408,10 +393,7 @@ namespace OpenSim.Services.Connectors { "ITEMS", slist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public InventoryItemBase GetItem(InventoryItemBase item) @@ -423,9 +405,7 @@ namespace OpenSim.Services.Connectors { "ID", item.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildItem((Dictionary)ret["item"]); @@ -447,9 +427,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -469,7 +447,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) + if (!CheckReturn(ret)) return null; List items = new List(); @@ -488,10 +466,22 @@ namespace OpenSim.Services.Connectors { "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) 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) @@ -508,9 +498,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders =