aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs61
1 files changed, 52 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
index ca64379..96061ba 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
73 private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>(); 73 private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>();
74 private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); 74 private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
75 private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); 75 private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>();
76 private List<UUID> m_rootAgents = new List<UUID>();
76 private Thread mapItemReqThread; 77 private Thread mapItemReqThread;
77 private volatile bool threadrunning = false; 78 private volatile bool threadrunning = false;
78 79
@@ -106,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
106 scene.EventManager.OnNewClient += OnNewClient; 107 scene.EventManager.OnNewClient += OnNewClient;
107 scene.EventManager.OnClientClosed += ClientLoggedOut; 108 scene.EventManager.OnClientClosed += ClientLoggedOut;
108 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 109 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
109 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 110 scene.EventManager.OnMakeRootAgent += MakeRootAgent;
110 111
111 112
112 } 113 }
@@ -261,7 +262,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
261 } 262 }
262 if (rootcount <= 1) 263 if (rootcount <= 1)
263 StopThread(); 264 StopThread();
264 265
266 lock (m_rootAgents)
267 {
268 if (m_rootAgents.Contains(AgentId))
269 {
270 m_rootAgents.Remove(AgentId);
271 }
272 }
265 273
266 } 274 }
267 #endregion 275 #endregion
@@ -275,9 +283,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
275 private void StartThread(object o) 283 private void StartThread(object o)
276 { 284 {
277 if (threadrunning) return; 285 if (threadrunning) return;
278
279 m_log.Warn("[WorldMap]: Starting remote MapItem request thread");
280 threadrunning = true; 286 threadrunning = true;
287 m_log.Warn("[WorldMap]: Starting remote MapItem request thread");
281 mapItemReqThread = new Thread(new ThreadStart(process)); 288 mapItemReqThread = new Thread(new ThreadStart(process));
282 mapItemReqThread.IsBackground = true; 289 mapItemReqThread.IsBackground = true;
283 mapItemReqThread.Name = "MapItemRequestThread"; 290 mapItemReqThread.Name = "MapItemRequestThread";
@@ -307,6 +314,12 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
307 public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, 314 public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
308 uint EstateID, bool godlike, uint itemtype, ulong regionhandle) 315 uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
309 { 316 {
317
318 lock (m_rootAgents)
319 {
320 if (!m_rootAgents.Contains(remoteClient.AgentId))
321 return;
322 }
310 uint xstart = 0; 323 uint xstart = 0;
311 uint ystart = 0; 324 uint ystart = 0;
312 Helpers.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 325 Helpers.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
@@ -387,8 +400,19 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
387 ThreadTracker.Remove(mapItemReqThread); 400 ThreadTracker.Remove(mapItemReqThread);
388 break; 401 break;
389 } 402 }
390 LLSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); 403
391 RequestMapItemsCompleted(response); 404 bool dorequest = true;
405 lock (m_rootAgents)
406 {
407 if (!m_rootAgents.Contains(st.agentID))
408 dorequest = false;
409 }
410
411 if (dorequest)
412 {
413 LLSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
414 RequestMapItemsCompleted(response);
415 }
392 } 416 }
393 threadrunning = false; 417 threadrunning = false;
394 m_log.Warn("[WorldMap]: Remote request thread exiting"); 418 m_log.Warn("[WorldMap]: Remote request thread exiting");
@@ -826,14 +850,25 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
826 return responsemap; 850 return responsemap;
827 } 851 }
828 852
829 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) 853
830 { 854 private void MakeRootAgent(ScenePresence avatar)
855 {
856
831 // You may ask, why this is in a threadpool to start with.. 857 // You may ask, why this is in a threadpool to start with..
832 // The reason is so we don't cause the thread to freeze waiting 858 // The reason is so we don't cause the thread to freeze waiting
833 // for the 1 second it costs to start a thread manually. 859 // for the 1 second it costs to start a thread manually.
834 860
861 m_log.Warn("[WORLDMAP]: MakeRootAgent Works!");
835 if (!threadrunning) 862 if (!threadrunning)
836 ThreadPool.QueueUserWorkItem(new WaitCallback(this.StartThread)); 863 ThreadPool.QueueUserWorkItem(new WaitCallback(this.StartThread));
864
865 lock (m_rootAgents)
866 {
867 if (!m_rootAgents.Contains(avatar.UUID))
868 {
869 m_rootAgents.Add(avatar.UUID);
870 }
871 }
837 } 872 }
838 873
839 private void MakeChildAgent(ScenePresence avatar) 874 private void MakeChildAgent(ScenePresence avatar)
@@ -850,6 +885,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
850 } 885 }
851 if (rootcount <= 1) 886 if (rootcount <= 1)
852 StopThread(); 887 StopThread();
888
889 lock (m_rootAgents)
890 {
891 if (m_rootAgents.Contains(avatar.UUID))
892 {
893 m_rootAgents.Remove(avatar.UUID);
894 }
895 }
853 } 896 }
854 } 897 }
855 898