From d582db6132ef7bea8b15e7a9f0dd64400d43b517 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Sep 2014 23:35:03 +0100 Subject: Fix recent regression from 473c5594 where camera started to judder on moving vehicles. Other parts of OpenSimulator are relying on SP.Velocity == 0 for vehicles. So add and use SP.GetWorldVelocity() instead when we need vehicle velocity, along the same lines as existing SP.GetWorldRotation() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 ++++++++++++++-------- .../Shared/Api/Implementation/LSL_Api.cs | 6 ++-- 2 files changed, 28 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e0b7640..f2a636a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -608,8 +608,11 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Current velocity of the avatar. + /// Velocity of the avatar with respect to its local reference frame. /// + /// + /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity() + /// public override Vector3 Velocity { get @@ -622,10 +625,10 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", // m_velocity, Name, Scene.RegionInfo.RegionName); } - else if (ParentPart != null) - { - return ParentPart.ParentGroup.Velocity; - } +// else if (ParentPart != null) +// { +// return ParentPart.ParentGroup.Velocity; +// } return m_velocity; } @@ -749,25 +752,32 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Gets the world rotation of this presence. + /// Get rotation relative to the world. /// - /// - /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. - /// /// public Quaternion GetWorldRotation() { - if (IsSatOnObject) - { - SceneObjectPart sitPart = ParentPart; + SceneObjectPart sitPart = ParentPart; - if (sitPart != null) - return sitPart.GetWorldRotation() * Rotation; - } + if (sitPart != null) + return sitPart.GetWorldRotation() * Rotation; return Rotation; } + /// + /// Get velocity relative to the world. + /// + public Vector3 GetWorldVelocity() + { + SceneObjectPart sitPart = ParentPart; + + if (sitPart != null) + return sitPart.ParentGroup.Velocity; + + return Velocity; + } + public void AdjustKnownSeeds() { Dictionary seeds; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5d7fc9d..7c384b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2560,7 +2560,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.IsAttachment) { ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); - vel = avatar.Velocity; + vel = avatar.GetWorldVelocity(); } else { @@ -11221,7 +11221,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Rotation(av.GetWorldRotation())); break; case ScriptBaseClass.OBJECT_VELOCITY: - ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); + ret.Add(new LSL_Vector(av.GetWorldVelocity())); break; case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(id)); @@ -11342,7 +11342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); if (sp != null) - vel = sp.Velocity; + vel = sp.GetWorldVelocity(); } else { -- cgit v1.1 From ac866a1c46583e50e74aefad0a1bc6de720a7211 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 00:25:56 +0100 Subject: Add [EntityTransfer] AllowAvatarCrossing setting to determine whether avatars are allowed to cross regions at all. Defaults to true. For test purposes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 17 +++++++++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18376c3..5f0dbd7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -224,6 +224,12 @@ namespace OpenSim.Region.Framework.Scenes public bool m_clampPrimSize; public bool m_trustBinaries; public bool m_allowScriptCrossings = true; + + /// + /// Can avatars cross from and to this region? + /// + public bool AllowAvatarCrossing { get; set; } + public bool m_useFlySlow; public bool m_useTrashOnDelete = true; @@ -1023,6 +1029,12 @@ namespace OpenSim.Region.Framework.Scenes #endregion Region Config + IConfig entityTransferConfig = m_config.Configs["EntityTransfer"]; + if (entityTransferConfig != null) + { + AllowAvatarCrossing = entityTransferConfig.GetBoolean("AllowAvatarCrossing", AllowAvatarCrossing); + } + #region Interest Management IConfig interestConfig = m_config.Configs["InterestManagement"]; @@ -1091,6 +1103,8 @@ namespace OpenSim.Region.Framework.Scenes CollidablePrims = true; PhysicsEnabled = true; + AllowAvatarCrossing = true; + PeriodicBackup = true; UseBackup = true; @@ -5613,6 +5627,9 @@ namespace OpenSim.Region.Framework.Scenes return true; } + if (!AllowAvatarCrossing && !viaTeleport) + return false; + // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. // However, the long term fix is to make sure root agent count is always accurate. m_sceneGraph.RecalculateStats(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f2a636a..3c37de8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3226,7 +3226,8 @@ namespace OpenSim.Region.Framework.Scenes m_lastVelocity = Velocity; } - CheckForBorderCrossing(); + if (Scene.AllowAvatarCrossing) + CheckForBorderCrossing(); CheckForSignificantMovement(); // sends update to the modules. } -- cgit v1.1 From 40c579addf86b4dff23cf67062a879e95e89bf51 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Wed, 3 Sep 2014 14:14:26 -0400 Subject: Don't show the ScrLPS data twice in the WebStats based statistics page. --- OpenSim/Region/UserStatistics/SimStatsAJAX.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs index ad848a1..06d9e91 100644 --- a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs +++ b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs @@ -162,9 +162,6 @@ namespace OpenSim.Region.UserStatistics output.Append("OthrMS"); HTMLUtil.TD_C(ref output); HTMLUtil.TD_O(ref output, TDHeaderClass); - output.Append("ScrLPS"); - HTMLUtil.TD_C(ref output); - HTMLUtil.TD_O(ref output, TDHeaderClass); output.Append("OutPPS"); HTMLUtil.TD_C(ref output); HTMLUtil.TD_O(ref output, TDHeaderClass); @@ -194,9 +191,6 @@ namespace OpenSim.Region.UserStatistics output.Append(sdata.OtherFrameTime); HTMLUtil.TD_C(ref output); HTMLUtil.TD_O(ref output, TDDataClassCenter); - output.Append(sdata.ScriptLinesPerSecond); - HTMLUtil.TD_C(ref output); - HTMLUtil.TD_O(ref output, TDDataClassCenter); output.Append(sdata.OutPacketsPerSecond); HTMLUtil.TD_C(ref output); HTMLUtil.TD_O(ref output, TDDataClassCenter); -- cgit v1.1 From b08ab1e3754da4a2855bb77fca91dce01e9c2fae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:31:45 +0100 Subject: If BulletSim is running on its own threads, start this thread via the thread watchdog. This allows us to see the presence of the permanent thread via the "show threads" console comand. Also adds the region name to the thread name. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index f7317c0..d3b2ad7 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -32,6 +32,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; using OpenSim.Framework; +using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; @@ -286,9 +287,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters if (BSParam.UseSeparatePhysicsThread) { // The physics simulation should happen independently of the heartbeat loop - m_physicsThread = new Thread(BulletSPluginPhysicsThread); - m_physicsThread.Name = BulletEngineName; - m_physicsThread.Start(); + m_physicsThread + = Watchdog.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + false); } } -- cgit v1.1 From 29400538b7bb9505ab2873d90680d9ad4cb101d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:37:20 +0100 Subject: minor: fix indenting from previous commit b08ab1e --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index d3b2ad7..f87c6c4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -287,13 +287,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters if (BSParam.UseSeparatePhysicsThread) { // The physics simulation should happen independently of the heartbeat loop - m_physicsThread - = Watchdog.StartThread( - BulletSPluginPhysicsThread, - string.Format("{0} ({1})", BulletEngineName, RegionName), - ThreadPriority.Normal, - true, - false); + m_physicsThread + = Watchdog.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + false); } } -- cgit v1.1 From 6e6512eb4a9fb9fb88d5ec7f3968598f3012b356 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:43:59 +0100 Subject: Make bulletsim thread alarm if no update for 5 seconds. The cost is minimal (also done for scene loop) at the benefit of telling us if this thread simply stops for some reason. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index f87c6c4..338593f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -293,7 +293,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters string.Format("{0} ({1})", BulletEngineName, RegionName), ThreadPriority.Normal, true, - false); + true); } } @@ -861,6 +861,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // TODO. DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); } + + if (BSParam.UseSeparatePhysicsThread) + Watchdog.UpdateThread(); } } -- cgit v1.1 From 4b04d22899e954831c4bf0904b5c2d9adacf650a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:53:04 +0100 Subject: Don't need to check separate physics status in bulletsim update since that method is only run for an indepndent thread anyway. Also remove bulletsim monitored thread from watchdog on shutdown. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 338593f..a46c241 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -862,9 +862,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); } - if (BSParam.UseSeparatePhysicsThread) - Watchdog.UpdateThread(); + Watchdog.UpdateThread(); } + + Watchdog.RemoveThread(); } #endregion // Simulation -- cgit v1.1 From 0692ebfbc6bfbbae428d79cb824622cea297fbaf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Sep 2014 00:00:51 +0100 Subject: Start long-lived thread in IRCConnector via watchdog rather than indepedently, so that it can be seen in "show threads" and stats --- .../Region/OptionalModules/Avatar/Chat/IRCConnector.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs index f5bd44d..bdd07e0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs @@ -109,10 +109,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat internal int m_resetk = 0; - // Working threads - - private Thread m_listener = null; - private Object msyncConnect = new Object(); internal bool m_randomizeNick = true; // add random suffix @@ -363,10 +359,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port); - m_listener = new Thread(new ThreadStart(ListenerRun)); - m_listener.Name = "IRCConnectorListenerThread"; - m_listener.IsBackground = true; - m_listener.Start(); + Watchdog.StartThread(ListenerRun, "IRCConnectionListenerThread", ThreadPriority.Normal, true, false); // This is the message order recommended by RFC 2812 if (m_password != null) @@ -510,21 +503,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat { while (m_enabled && m_connected) { - if ((inputLine = m_reader.ReadLine()) == null) throw new Exception("Listener input socket closed"); + Watchdog.UpdateThread(); + // m_log.Info("[IRCConnector]: " + inputLine); if (inputLine.Contains("PRIVMSG")) { - Dictionary data = ExtractMsg(inputLine); // Any chat ??? if (data != null) { - OSChatMessage c = new OSChatMessage(); c.Message = data["msg"]; c.Type = ChatTypeEnum.Region; @@ -540,9 +532,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9)); ChannelState.OSChat(this, c, false); - } - } else { @@ -562,6 +552,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat if (m_enabled && (m_resetk == resetk)) Reconnect(); + + Watchdog.RemoveThread(); } private Regex RE = new Regex(@":(?[\w-]*)!(?\S*) PRIVMSG (?\S+) :(?.*)", -- cgit v1.1 From 73e20b7f5f3c6b8b45233cc04e5c6abce0d6b0a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Sep 2014 00:22:30 +0100 Subject: For processing outbound http requests in the XMLRPCModule, start the thread through Watchdog for monitoring and stat purposes. --- OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index c6e05b1..d7ea906 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -36,6 +36,7 @@ using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Monitoring; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; @@ -656,12 +657,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC public void Process() { - httpThread = new Thread(SendRequest); - httpThread.Name = "HttpRequestThread"; - httpThread.Priority = ThreadPriority.BelowNormal; - httpThread.IsBackground = true; _finished = false; - httpThread.Start(); + Watchdog.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); } /* @@ -733,6 +730,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } _finished = true; + + Watchdog.RemoveThread(); } public void Stop() -- cgit v1.1