From bfce23dcf4f902d6967bc483433eae3d2077c447 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 13 May 2008 06:05:45 +0000 Subject: * Implemented ChildAgentDataUpdate throttle multiplier based on an inaccurate count of neighbors. * The neighbor count is always lower then the actual number of neighbors unless your region was up the longest. * The region you're in is un-affected by this, though, you'll get less packet loss, maybe not get logged off immediately when you log in, and possibly see more prim if your internet connection is semi-unreliable. --- OpenSim/Region/Environment/Scenes/Scene.cs | 39 ++++++++++++++++++++-- .../Scenes/SceneCommunicationService.cs | 7 ++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 19 ++++++++++- 3 files changed, 62 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e18c467..f0a0921 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -361,11 +361,12 @@ namespace OpenSim.Region.Environment.Scenes // If the RegionInfo isn't exact but is for the same XY World location, // then the above loop will fix that. - if (!(m_neighbours.Contains(otherRegion))) + if (!(CheckNeighborRegion(otherRegion))) { lock (m_neighbours) { m_neighbours.Add(otherRegion); + //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString()); } } // If these are cast to INT because long + negative values + abs returns invalid data @@ -407,7 +408,36 @@ namespace OpenSim.Region.Environment.Scenes } // Given float seconds, this will restart the region. + public void AddNeighborRegion(RegionInfo region) + { + lock (m_neighbours) + { + if (!CheckNeighborRegion(region)) + { + m_neighbours.Add(region); + + } + } + } + public bool CheckNeighborRegion(RegionInfo region) + { + bool found = false; + lock (m_neighbours) + { + foreach (RegionInfo reg in m_neighbours) + { + if (reg.RegionHandle == region.RegionHandle) + { + found = true; + break; + } + } + } + return found; + + + } public virtual void Restart(float seconds) { // notifications are done in 15 second increments @@ -556,7 +586,11 @@ namespace OpenSim.Region.Environment.Scenes } } - + public int GetInaccurateNeighborCount() + { + lock (m_neighbours) + return m_neighbours.Count; + } // This is the method that shuts down the scene. public override void Close() { @@ -647,6 +681,7 @@ namespace OpenSim.Region.Environment.Scenes // Aquire a lock so only one update call happens at once updateLock.WaitOne(); float physicsFPS = 0; + //m_log.Info("sadfadf" + m_neighbours.Count.ToString()); int agentsInScene = m_innerScene.GetRootAgentCount() + m_innerScene.GetChildAgentCount(); if (agentsInScene > 21) diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 5ef4a7d..c9274dd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -361,6 +361,13 @@ namespace OpenSim.Region.Environment.Scenes if (regionAccepted) { m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here"); + handlerRegionUp = OnRegionUp; + + // yes, we're notifying ourselves. + if (handlerRegionUp != null) + handlerRegionUp(region); + + } else { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5b10bfc..3189b10 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1568,7 +1568,24 @@ namespace OpenSim.Region.Environment.Scenes cadu.GroupAccess = 0; cadu.Position = new sLLVector3(AbsolutePosition); cadu.regionHandle = m_scene.RegionInfo.RegionHandle; - cadu.throttles = ControllingClient.GetThrottlesPacked(1f); + float multiplier = 1; + int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); + if (innacurateNeighbors != 0) + { + multiplier = 1f / (float)innacurateNeighbors; + } + if (multiplier <= 0f) + { + multiplier = 0.25f; + } + + //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString()); + cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); + + + + + cadu.Velocity = new sLLVector3(Velocity); m_scene.SendOutChildAgentUpdates(cadu,this); m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; -- cgit v1.1