From e77f91311678154390d09b586fbd8162cd3bb601 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 Nov 2016 22:34:56 +0000 Subject: minor: dont let rcvd agentupdates time jump back --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 38 +++++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3378ead..f73d54e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2318,7 +2318,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 tocam = CameraPosition - posAdjusted; float distTocamlen = tocam.LengthSquared(); - if (distTocamlen > 0.08f && distTocamlen < 400) + if (distTocamlen > 0.01f && distTocamlen < 400) { distTocamlen = (float)Math.Sqrt(distTocamlen); tocam *= (1.0f / distTocamlen); @@ -4378,16 +4378,12 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat( "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", knownRegions.Count, Scene.RegionInfo.RegionName); - //DumpKnownRegions(); Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); uint x, y; spRegionSizeInfo regInfo; - // this should not be here - IEventQueue eventQueue = Scene.RequestModuleInterface(); - foreach (ulong handle in knownRegions) { // Don't close the agent on this region yet @@ -4400,16 +4396,10 @@ namespace OpenSim.Region.Framework.Scenes Util.RegionHandleToRegionLoc(handle, out x, out y); if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) { - - // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); - // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) { byebyeRegions.Add(handle); - // this should not be here -// if(eventQueue != null) -/// eventQueue.DisableSimulator(handle,UUID); } } else @@ -4445,6 +4435,32 @@ namespace OpenSim.Region.Framework.Scenes } } + public void closeAllChildAgents() + { + List byebyeRegions = new List(); + List knownRegions = KnownRegionHandles; + foreach (ulong handle in knownRegions) + { + if (handle != Scene.RegionInfo.RegionHandle) + { + byebyeRegions.Add(handle); + RemoveNeighbourRegion(handle); + Scene.CapsModule.DropChildSeed(UUID, handle); + } + } + + if (byebyeRegions.Count > 0) + { + m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); + + AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID); + string auth = string.Empty; + if (acd != null) + auth = acd.SessionID.ToString(); + m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions); + } + } + #endregion /// -- cgit v1.1 From 35b37510fca537d12c2eabc68be51e370dc6d6ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 Nov 2016 19:15:28 +0000 Subject: explicitly remove some references, and other useless changes --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f73d54e..2cfdd94 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1104,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes AdjustKnownSeeds(); - RegisterToEvents(); + RegisterToClientEvents(); SetDirectionVectors(); Appearance = appearance; @@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void RegisterToEvents() + public void RegisterToClientEvents() { ControllingClient.OnCompleteMovementToRegion += CompleteMovement; ControllingClient.OnAgentUpdate += HandleAgentUpdate; @@ -1189,6 +1189,22 @@ namespace OpenSim.Region.Framework.Scenes // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); } + + public void RemoveClientEvents() + { + ControllingClient.OnCompleteMovementToRegion -= CompleteMovement; + ControllingClient.OnAgentUpdate -= HandleAgentUpdate; + ControllingClient.OnAgentCameraUpdate -= HandleAgentCamerasUpdate; + ControllingClient.OnAgentRequestSit -= HandleAgentRequestSit; + ControllingClient.OnAgentSit -= HandleAgentSit; + ControllingClient.OnSetAlwaysRun -= HandleSetAlwaysRun; + ControllingClient.OnStartAnim -= HandleStartAnim; + ControllingClient.OnStopAnim -= HandleStopAnim; + ControllingClient.OnChangeAnim -= avnHandleChangeAnim; + ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; + ControllingClient.OnAutoPilotGo -= MoveToTarget; + ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; + } private void SetDirectionVectors() { @@ -5016,12 +5032,16 @@ namespace OpenSim.Region.Framework.Scenes RemoveFromPhysicalScene(); m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; + RemoveClientEvents(); // if (Animator != null) // Animator.Close(); Animator = null; + scriptedcontrols.Clear(); + ControllingClient = null; LifecycleState = ScenePresenceState.Removed; + IsDeleted = true; } public void AddAttachment(SceneObjectGroup gobj) -- cgit v1.1