start TerrainCheckUpdates on heartbeat thread, but do it async; fix a bug on slow terrain send limits check

avinationmerge
UbitUmarov 2015-11-10 17:44:53 +00:00
parent b6c3592411
commit 5bfd49404d
1 changed files with 33 additions and 18 deletions

View File

@ -785,13 +785,26 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave);
}
/// <summary>
/// This is used to check to see of any of the terrain is tainted and, if so, schedule
/// updates for all the presences.
/// This also checks to see if there are updates that need to be sent for each presence.
/// This is where the logic is to send terrain updates to clients.
/// </summary>
/// doing it async, since currently this is 2 heavy for heartbeat
private void EventManager_TerrainCheckUpdates()
{
Util.FireAndForget(
EventManager_TerrainCheckUpdatesAsync);
}
object TerrainCheckUpdatesLock = new object();
private void EventManager_TerrainCheckUpdatesAsync(object o)
{
// dont overlap execution
Monitor.TryEnter(TerrainCheckUpdatesLock);
{
// this needs fixing
TerrainData terrData = m_channel.GetTerrainData();
@ -819,6 +832,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_scene.EventManager.TriggerTerrainTainted();
m_tainted = true;
}
Monitor.Exit(TerrainCheckUpdatesLock);
}
}
/// <summary>
@ -1083,7 +1098,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
if (pups.sendAllcurrentX > limitX || pups.sendAllcurrentY > limitY)
if (pups.sendAllcurrentX > limitX && pups.sendAllcurrentY > limitY)
{
pups.sendAll = false;
pups.sendAllcurrentX = 0;