aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-11-10 17:44:53 +0000
committerUbitUmarov2015-11-10 17:44:53 +0000
commit5bfd49404d9ae3918f3e266af6dc5839407581e4 (patch)
tree230003cb88426a3d659093849e31388eddde8704
parent fix/add lldialog and llTextBox message size error checks, aborting if error ... (diff)
downloadopensim-SC-5bfd49404d9ae3918f3e266af6dc5839407581e4.zip
opensim-SC-5bfd49404d9ae3918f3e266af6dc5839407581e4.tar.gz
opensim-SC-5bfd49404d9ae3918f3e266af6dc5839407581e4.tar.bz2
opensim-SC-5bfd49404d9ae3918f3e266af6dc5839407581e4.tar.xz
start TerrainCheckUpdates on heartbeat thread, but do it async; fix a bug on slow terrain send limits check
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs51
1 files changed, 33 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index c9aa3a3..11d08ad 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -785,39 +785,54 @@ namespace OpenSim.Region.CoreModules.World.Terrain
785 m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave); 785 m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave);
786 } 786 }
787 787
788
788 /// <summary> 789 /// <summary>
789 /// This is used to check to see of any of the terrain is tainted and, if so, schedule 790 /// This is used to check to see of any of the terrain is tainted and, if so, schedule
790 /// updates for all the presences. 791 /// updates for all the presences.
791 /// This also checks to see if there are updates that need to be sent for each presence. 792 /// This also checks to see if there are updates that need to be sent for each presence.
792 /// This is where the logic is to send terrain updates to clients. 793 /// This is where the logic is to send terrain updates to clients.
793 /// </summary> 794 /// </summary>
795 /// doing it async, since currently this is 2 heavy for heartbeat
794 private void EventManager_TerrainCheckUpdates() 796 private void EventManager_TerrainCheckUpdates()
795 { 797 {
796 // this needs fixing 798 Util.FireAndForget(
797 TerrainData terrData = m_channel.GetTerrainData(); 799 EventManager_TerrainCheckUpdatesAsync);
800 }
798 801
799 bool shouldTaint = false; 802 object TerrainCheckUpdatesLock = new object();
800 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) 803
804 private void EventManager_TerrainCheckUpdatesAsync(object o)
805 {
806 // dont overlap execution
807 Monitor.TryEnter(TerrainCheckUpdatesLock);
801 { 808 {
802 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 809 // this needs fixing
810 TerrainData terrData = m_channel.GetTerrainData();
811
812 bool shouldTaint = false;
813 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
803 { 814 {
804 if (terrData.IsTaintedAt(x, y,true)) 815 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
805 { 816 {
806 // Found a patch that was modified. Push this flag into the clients. 817 if (terrData.IsTaintedAt(x, y,true))
807 SendToClients(terrData, x, y); 818 {
808 shouldTaint = true; 819 // Found a patch that was modified. Push this flag into the clients.
820 SendToClients(terrData, x, y);
821 shouldTaint = true;
822 }
809 } 823 }
810 } 824 }
811 }
812 825
813 // This event also causes changes to be sent to the clients 826 // This event also causes changes to be sent to the clients
814 CheckSendingPatchesToClients(); 827 CheckSendingPatchesToClients();
815 828
816 // If things changes, generate some events 829 // If things changes, generate some events
817 if (shouldTaint) 830 if (shouldTaint)
818 { 831 {
819 m_scene.EventManager.TriggerTerrainTainted(); 832 m_scene.EventManager.TriggerTerrainTainted();
820 m_tainted = true; 833 m_tainted = true;
834 }
835 Monitor.Exit(TerrainCheckUpdatesLock);
821 } 836 }
822 } 837 }
823 838
@@ -1083,7 +1098,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1083 int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize; 1098 int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
1084 int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize; 1099 int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
1085 1100
1086 if (pups.sendAllcurrentX > limitX || pups.sendAllcurrentY > limitY) 1101 if (pups.sendAllcurrentX > limitX && pups.sendAllcurrentY > limitY)
1087 { 1102 {
1088 pups.sendAll = false; 1103 pups.sendAll = false;
1089 pups.sendAllcurrentX = 0; 1104 pups.sendAllcurrentX = 0;