From f81375cf1e8f750f3491523d60eeb02eea785a6e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 25 Oct 2017 02:59:19 +0100 Subject: [PATCH 1/6] mantis 8253: try to recover information about takecontrols pass=false controls on crossings, also tell viewers about them. this may still not be correct. Use of multiple TakeControls on same avatar can still give unpredictable results (also on normal operation). In same cases last executed my override previus or not. Also change agent updates wait code --- .../Region/Framework/Scenes/ScenePresence.cs | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cceb06d5b..059a846e82 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -457,6 +457,9 @@ namespace OpenSim.Region.Framework.Scenes /// private object m_originRegionIDAccessLock = new object(); + + private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false); + /// /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent /// teleport is reusing the connection. @@ -1950,30 +1953,32 @@ namespace OpenSim.Region.Framework.Scenes // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero -// m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); - int count = 50; - UUID originID = UUID.Zero; - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - while (originID.Equals(UUID.Zero) && count-- > 0) + try { - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; + if(m_updateAgentReceivedAfterTransferEvent.WaitOne(10000)) + { + UUID originID = UUID.Zero; - m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); - Thread.Sleep(200); + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + if (originID.Equals(UUID.Zero)) + { + // Movement into region will fail + m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} got invalid origin region id ", client.Name, Scene.Name); + return false; + } + return true; + } + else + { + m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} did not receive agent update ", client.Name, Scene.Name); + return false; + } } + catch { } - if (originID.Equals(UUID.Zero)) - { - // Movement into region will fail - m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name); - return false; - } - - return true; + return false; } public void RotateToLookAt(Vector3 lookAt) @@ -2283,6 +2288,13 @@ namespace OpenSim.Region.Framework.Scenes } } + if(gotCrossUpdate) + { + if(IgnoredControls != ScriptControlled.CONTROL_ZERO) + ControllingClient.SendTakeControls((int)IgnoredControls, false, true); + + } + m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (openChildAgents) { @@ -4574,7 +4586,7 @@ namespace OpenSim.Region.Framework.Scenes return; CopyFrom(cAgentData); - + m_updateAgentReceivedAfterTransferEvent.Set(); } private static Vector3 marker = new Vector3(-1f, -1f, -1f); @@ -4787,6 +4799,10 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(isFlying); } */ + + if (Scene.AttachmentsModule != null) + Scene.AttachmentsModule.CopyAttachments(cAgent, this); + try { lock (scriptedcontrols) @@ -4794,6 +4810,7 @@ namespace OpenSim.Region.Framework.Scenes if (cAgent.Controllers != null) { scriptedcontrols.Clear(); + IgnoredControls = ScriptControlled.CONTROL_ZERO; foreach (ControllerData c in cAgent.Controllers) { @@ -4804,6 +4821,7 @@ namespace OpenSim.Region.Framework.Scenes sc.eventControls = (ScriptControlled)c.EventControls; scriptedcontrols[sc.itemID] = sc; + IgnoredControls |= sc.ignoreControls; // this is not correct, aparently only last applied should count } } } @@ -4824,8 +4842,6 @@ namespace OpenSim.Region.Framework.Scenes if (cAgent.MotionState != 0) Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; - if (Scene.AttachmentsModule != null) - Scene.AttachmentsModule.CopyAttachments(cAgent, this); crossingFlags = cAgent.CrossingFlags; gotCrossUpdate = (crossingFlags != 0); @@ -5108,6 +5124,8 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient = null; LifecycleState = ScenePresenceState.Removed; IsDeleted = true; + m_updateAgentReceivedAfterTransferEvent.Dispose(); + m_updateAgentReceivedAfterTransferEvent = null; } public void AddAttachment(SceneObjectGroup gobj) From d65f055e4eb7fe2861308670b97817f9a61376c6 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 26 Oct 2017 11:26:49 -0400 Subject: [PATCH 2/6] Whitespace cleanup. --- .../Shared/Api/Implementation/OSSL_Api.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ba07f9c316..cdeb117764 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed.. - // for safe funtions always active + // for safe funtions always active public void CheckThreatLevel() { m_host.AddScriptLPS(1); @@ -1056,7 +1056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api targetID, part.SitTargetPosition); } - + // Get a list of all the avatars/agents in the region public LSL_List osGetAgents() { @@ -1074,7 +1074,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public string osGetAgentIP(string agent) { - CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP"); + CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP"); if(!(World.Permissions.IsGod(m_host.OwnerID))) // user god always needed return ""; @@ -1651,7 +1651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else { if (UUID.TryParse(arg, out uuid)) - { + { if(newLand.OwnerID != uuid) { changed = true; @@ -1760,7 +1760,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(changedSeeAvs && avatar.currentParcelUUID == parcelID ) avatar.currentParcelUUID = parcelID; // force parcel flags review - + if(avatar.ControllingClient == null) return; @@ -4500,7 +4500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// LSL_Vector CenterOfMass, center mass relative to root prim /// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass /// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass - /// + /// public LSL_List osGetInertiaData() { CheckThreatLevel(); @@ -4513,8 +4513,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectGroup sog = m_host.ParentGroup; if(sog== null || sog.IsDeleted) - return result; - + return result; + sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux ); if(TotalMass > 0) { @@ -4538,7 +4538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// set inertial data /// replaces the automatic calculation of mass, center of mass and inertia - /// + /// /// /// total mass of linkset /// location of center of mass relative to root prim in local coords @@ -4562,7 +4562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // need more checks Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); - Vector3 Inertia; + Vector3 Inertia; float m = (float)mass; Inertia.X = m * (float)principalInertiaScaled.x; @@ -4578,7 +4578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// set inertial data as a sphere /// replaces the automatic calculation of mass, center of mass and inertia - /// + /// /// /// total mass of linkset /// size of the Box @@ -4600,7 +4600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // need more checks Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); - Vector3 Inertia; + Vector3 Inertia; float lx = (float)boxSize.x; float ly = (float)boxSize.y; float lz = (float)boxSize.z; @@ -4620,7 +4620,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// set inertial data as a sphere /// replaces the automatic calculation of mass, center of mass and inertia - /// + /// /// /// total mass of linkset /// radius of the sphere @@ -4639,9 +4639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; // need more checks - + Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); - Vector3 Inertia; + Vector3 Inertia; float r = (float)radius; float m = (float)mass; float t = 0.4f * m * r * r; @@ -4656,7 +4656,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// set inertial data as a cylinder /// replaces the automatic calculation of mass, center of mass and inertia - /// + /// /// /// total mass of linkset /// radius of the cylinder @@ -4678,9 +4678,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; // need more checks - + Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); - Vector3 Inertia; + Vector3 Inertia; float m = (float)mass; float r = (float)radius; r *= r; @@ -4702,7 +4702,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// removes inertial data manual override /// default automatic calculation is used again - /// + /// /// public void osClearInertia() { From fbb2f7f319125fc7abb4f521153ab937e222d3ce Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 26 Oct 2017 13:29:14 -0400 Subject: [PATCH 3/6] Corrected name of function in call to CheckThreatLevel. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index cdeb117764..6e28fe066c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3593,7 +3593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public int osGetSimulatorMemoryKB() { - CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); + CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemoryKB"); long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; From 5cc41eee3412a5ad138bd410cc662efae3261c24 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 26 Oct 2017 13:40:59 -0400 Subject: [PATCH 4/6] Sorted the groups of Allow statements by alphabetical order. --- bin/config-include/osslEnable.ini | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index aa7c90b06f..4b0d3d24c3 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -77,7 +77,7 @@ Allow_osGetGender = true Allow_osGetHealth = true Allow_osGetHealRate = true - Allow_osGetNPCList = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER + Allow_osGetNPCList = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER Allow_osGetRezzingObject = true Allow_osNpcGetOwner = ${XEngine|osslNPC} Allow_osParseJSON = true @@ -121,7 +121,7 @@ Allow_osLoadedCreationTime = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER Allow_osMessageObject = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER Allow_osRegexIsMatch = true - Allow_osGetAvatarHomeURI = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER + Allow_osGetAvatarHomeURI = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER Allow_osNpcSetProfileAbout = ${XEngine|osslNPC} Allow_osNpcSetProfileImage = ${XEngine|osslNPC} Allow_osDie = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER @@ -221,28 +221,28 @@ Allow_osGetAgentIP = true ; always restricted to Administrators (true or false to disable) ; available functions out of Threat level control (for reference only) -; Allow_osClearInertia = true ; Allow_osCheckODE = true +; Allow_osClearInertia = true ; Allow_osCollisionSound = true ; Allow_osDrawEllipse = true ; Allow_osDrawFilledEllipse = true ; Allow_osDrawFilledPolygon = true ; Allow_osDrawFilledRectangle = true -; Allow_osDrawResetTransform = true -; Allow_osDrawRotationTransform = true -; Allow_osDrawScaleTransform = true -; Allow_osDrawTranslationTransform = true ; Allow_osDrawImage = true ; Allow_osDrawLine = true ; Allow_osDrawPolygon = true ; Allow_osDrawRectangle = true +; Allow_osDrawResetTransform = true +; Allow_osDrawRotationTransform = true +; Allow_osDrawScaleTransform = true ; Allow_osDrawText = true +; Allow_osDrawTranslationTransform = true ; Allow_osGetCurrentSunHour = true -; Allow_osGetPhysicsEngineName = true ; Allow_osGetInertiaData = true ; Allow_osGetInventoryDesc = true ; Allow_osGetLinkNumber = true ; Allow_osGetMapTexture = true +; Allow_osGetPhysicsEngineName = true ; Allow_osGetRegionSize = true ; Allow_osGetSunParam = true ; Allow_osGetTerrainHeight = true @@ -253,12 +253,12 @@ ; Allow_osMax = true ; Allow_osMin = true ; Allow_osMovePen = true +; Allow_osSetFontName = true +; Allow_osSetFontSize = true ; Allow_osSetInertia = true ; Allow_osSetInertiaAsBox = true ; Allow_osSetInertiaAsSphere = true ; Allow_osSetInertiaAsCylinder = true -; Allow_osSetFontName = true -; Allow_osSetFontSize = true ; Allow_osSetPenCap = true ; Allow_osSetPenColor = true ; Allow_osSetPenSize = true From 70d693eff2553299839f23f840ff7c08363ada3e Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 26 Oct 2017 13:42:54 -0400 Subject: [PATCH 5/6] Added missing Allow line for osGetSimulatorMemoryKB. --- bin/config-include/osslEnable.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index 4b0d3d24c3..aed43f0280 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -138,6 +138,7 @@ Allow_osGetNumberOfAttachments = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osGetRegionStats = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osGetSimulatorMemory = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osGetSimulatorMemoryKB = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osMessageAttachments = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osSetSpeed = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER From 6a5b234262aaadb5adccdbe775a6057269e8036c Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 26 Oct 2017 13:43:36 -0400 Subject: [PATCH 6/6] Fixed typo in a comment. --- bin/OpenSimDefaults.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 3747fcf6af..bb81c95d43 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -2047,7 +2047,7 @@ ;MessagingEnabled = true ; Experimental option to only message cached online users rather than all users - ; Should make large group with few online members messaging faster, as the expense of more calls to ROBUST presence service + ; Should make large group with few online members messaging faster, at the expense of more calls to ROBUST presence service ; (Flotsam groups only; in V2 this is always on) MessageOnlineUsersOnly = false