aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs49
2 files changed, 45 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
index 1554b3e..a70261e 100644
--- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
@@ -181,11 +181,10 @@ namespace OpenSim.Region.CoreModules.Framework
181 181
182 m_RequestQueue.Enqueue(delegate 182 m_RequestQueue.Enqueue(delegate
183 { 183 {
184 continuation();
185 lock (m_RequestQueue) 184 lock (m_RequestQueue)
186 {
187 m_Pending[category].Remove(itemid); 185 m_Pending[category].Remove(itemid);
188 } 186
187 continuation();
189 }); 188 });
190 } 189 }
191 } 190 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index c50ab64..a26a5f0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -81,6 +81,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
81 private List<UUID> m_rootAgents = new List<UUID>(); 81 private List<UUID> m_rootAgents = new List<UUID>();
82 private volatile bool threadrunning = false; 82 private volatile bool threadrunning = false;
83 83
84 private IServiceThrottleModule m_ServiceThrottle;
85
84 //private int CacheRegionsDistance = 256; 86 //private int CacheRegionsDistance = 256;
85 87
86 #region INonSharedRegionModule Members 88 #region INonSharedRegionModule Members
@@ -131,6 +133,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
131 133
132 public virtual void RegionLoaded (Scene scene) 134 public virtual void RegionLoaded (Scene scene)
133 { 135 {
136 if (!m_Enabled)
137 return;
138
139 m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>();
134 } 140 }
135 141
136 142
@@ -170,13 +176,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
170 m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; 176 m_scene.EventManager.OnMakeRootAgent += MakeRootAgent;
171 m_scene.EventManager.OnRegionUp += OnRegionUp; 177 m_scene.EventManager.OnRegionUp += OnRegionUp;
172 178
173 StartThread(new object()); 179// StartThread(new object());
174 } 180 }
175 181
176 // this has to be called with a lock on m_scene 182 // this has to be called with a lock on m_scene
177 protected virtual void RemoveHandlers() 183 protected virtual void RemoveHandlers()
178 { 184 {
179 StopThread(); 185// StopThread();
180 186
181 m_scene.EventManager.OnRegionUp -= OnRegionUp; 187 m_scene.EventManager.OnRegionUp -= OnRegionUp;
182 m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; 188 m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent;
@@ -526,7 +532,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
526 /// </summary> 532 /// </summary>
527 public void process() 533 public void process()
528 { 534 {
529 const int MAX_ASYNC_REQUESTS = 20; 535 //const int MAX_ASYNC_REQUESTS = 20;
530 try 536 try
531 { 537 {
532 while (true) 538 while (true)
@@ -571,13 +577,44 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
571 Watchdog.RemoveThread(); 577 Watchdog.RemoveThread();
572 } 578 }
573 579
580 const int MAX_ASYNC_REQUESTS = 20;
581
574 /// <summary> 582 /// <summary>
575 /// Enqueues the map item request into the processing thread 583 /// Enqueues the map item request into the services throttle processing thread
576 /// </summary> 584 /// </summary>
577 /// <param name="state"></param> 585 /// <param name="state"></param>
578 public void EnqueueMapItemRequest(MapRequestState state) 586 public void EnqueueMapItemRequest(MapRequestState st)
579 { 587 {
580 requests.Enqueue(state); 588
589 m_ServiceThrottle.Enqueue("map-item", st.regionhandle.ToString() + st.agentID.ToString(), delegate
590 {
591 if (st.agentID != UUID.Zero)
592 {
593 bool dorequest = true;
594 lock (m_rootAgents)
595 {
596 if (!m_rootAgents.Contains(st.agentID))
597 dorequest = false;
598 }
599
600 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
601 {
602 if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
603 {
604 // AH!!! Recursive !
605 // Put this request back in the queue and return
606 EnqueueMapItemRequest(st);
607 return;
608 }
609
610 RequestMapItemsDelegate d = RequestMapItemsAsync;
611 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
612 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
613 //RequestMapItemsCompleted(response);
614 Interlocked.Increment(ref nAsyncRequests);
615 }
616 }
617 });
581 } 618 }
582 619
583 /// <summary> 620 /// <summary>