diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2544c7f..94d3011 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -74,9 +74,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
74 | /// </remarks> | 74 | /// </remarks> |
75 | public bool ProcessQueuedRequestsAsync { get; private set; } | 75 | public bool ProcessQueuedRequestsAsync { get; private set; } |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Number of inventory requests processed by this module. | ||
79 | /// </summary> | ||
80 | /// <remarks> | ||
81 | /// It's the PollServiceRequestManager that actually sends completed requests back to the requester. | ||
82 | /// </remarks> | ||
83 | public int ProcessedRequestsCount { get; set; } | ||
84 | |||
77 | private Stat m_queuedRequestsStat; | 85 | private Stat m_queuedRequestsStat; |
86 | private Stat m_processedRequestsStat; | ||
78 | 87 | ||
79 | private Scene m_scene; | 88 | public Scene Scene { get; private set; } |
80 | 89 | ||
81 | private IInventoryService m_InventoryService; | 90 | private IInventoryService m_InventoryService; |
82 | private ILibraryService m_LibraryService; | 91 | private ILibraryService m_LibraryService; |
@@ -122,7 +131,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
122 | if (!m_Enabled) | 131 | if (!m_Enabled) |
123 | return; | 132 | return; |
124 | 133 | ||
125 | m_scene = s; | 134 | Scene = s; |
126 | } | 135 | } |
127 | 136 | ||
128 | public void RemoveRegion(Scene s) | 137 | public void RemoveRegion(Scene s) |
@@ -130,8 +139,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
130 | if (!m_Enabled) | 139 | if (!m_Enabled) |
131 | return; | 140 | return; |
132 | 141 | ||
133 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 142 | Scene.EventManager.OnRegisterCaps -= RegisterCaps; |
134 | 143 | ||
144 | StatsManager.DeregisterStat(m_processedRequestsStat); | ||
135 | StatsManager.DeregisterStat(m_queuedRequestsStat); | 145 | StatsManager.DeregisterStat(m_queuedRequestsStat); |
136 | 146 | ||
137 | if (ProcessQueuedRequestsAsync) | 147 | if (ProcessQueuedRequestsAsync) |
@@ -145,7 +155,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
145 | } | 155 | } |
146 | } | 156 | } |
147 | 157 | ||
148 | m_scene = null; | 158 | Scene = null; |
149 | } | 159 | } |
150 | 160 | ||
151 | public void RegionLoaded(Scene s) | 161 | public void RegionLoaded(Scene s) |
@@ -153,6 +163,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
153 | if (!m_Enabled) | 163 | if (!m_Enabled) |
154 | return; | 164 | return; |
155 | 165 | ||
166 | m_processedRequestsStat = | ||
167 | new Stat( | ||
168 | "ProcessedFetchInventoryRequests", | ||
169 | "Number of processed fetch inventory requests", | ||
170 | "These have not necessarily yet been dispatched back to the requester.", | ||
171 | "", | ||
172 | "scene", | ||
173 | Scene.Name, | ||
174 | StatType.Pull, | ||
175 | MeasuresOfInterest.AverageChangeOverTime, | ||
176 | stat => { lock (m_queue) { stat.Value = ProcessedRequestsCount; } }, | ||
177 | StatVerbosity.Debug); | ||
178 | |||
156 | m_queuedRequestsStat = | 179 | m_queuedRequestsStat = |
157 | new Stat( | 180 | new Stat( |
158 | "QueuedFetchInventoryRequests", | 181 | "QueuedFetchInventoryRequests", |
@@ -160,21 +183,22 @@ namespace OpenSim.Region.ClientStack.Linden | |||
160 | "", | 183 | "", |
161 | "", | 184 | "", |
162 | "scene", | 185 | "scene", |
163 | m_scene.Name, | 186 | Scene.Name, |
164 | StatType.Pull, | 187 | StatType.Pull, |
165 | MeasuresOfInterest.AverageChangeOverTime, | 188 | MeasuresOfInterest.AverageChangeOverTime, |
166 | stat => { lock (m_queue) { stat.Value = m_queue.Count; } }, | 189 | stat => { lock (m_queue) { stat.Value = m_queue.Count; } }, |
167 | StatVerbosity.Debug); | 190 | StatVerbosity.Debug); |
168 | 191 | ||
192 | StatsManager.RegisterStat(m_processedRequestsStat); | ||
169 | StatsManager.RegisterStat(m_queuedRequestsStat); | 193 | StatsManager.RegisterStat(m_queuedRequestsStat); |
170 | 194 | ||
171 | m_InventoryService = m_scene.InventoryService; | 195 | m_InventoryService = Scene.InventoryService; |
172 | m_LibraryService = m_scene.LibraryService; | 196 | m_LibraryService = Scene.LibraryService; |
173 | 197 | ||
174 | // We'll reuse the same handler for all requests. | 198 | // We'll reuse the same handler for all requests. |
175 | m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | 199 | m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); |
176 | 200 | ||
177 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 201 | Scene.EventManager.OnRegisterCaps += RegisterCaps; |
178 | 202 | ||
179 | if (ProcessQueuedRequestsAsync && m_workerThreads == null) | 203 | if (ProcessQueuedRequestsAsync && m_workerThreads == null) |
180 | { | 204 | { |
@@ -215,12 +239,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
215 | private Dictionary<UUID, Hashtable> responses = | 239 | private Dictionary<UUID, Hashtable> responses = |
216 | new Dictionary<UUID, Hashtable>(); | 240 | new Dictionary<UUID, Hashtable>(); |
217 | 241 | ||
218 | private Scene m_scene; | 242 | private WebFetchInvDescModule m_module; |
219 | 243 | ||
220 | public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : | 244 | public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : |
221 | base(null, url, null, null, null, pId, int.MaxValue) | 245 | base(null, url, null, null, null, pId, int.MaxValue) |
222 | { | 246 | { |
223 | m_scene = scene; | 247 | m_module = module; |
224 | 248 | ||
225 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; | 249 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; |
226 | GetEvents = (x, y) => | 250 | GetEvents = (x, y) => |
@@ -240,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
240 | 264 | ||
241 | Request = (x, y) => | 265 | Request = (x, y) => |
242 | { | 266 | { |
243 | ScenePresence sp = m_scene.GetScenePresence(Id); | 267 | ScenePresence sp = m_module.Scene.GetScenePresence(Id); |
244 | if (sp == null) | 268 | if (sp == null) |
245 | { | 269 | { |
246 | m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); | 270 | m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); |
@@ -340,6 +364,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
340 | 364 | ||
341 | lock (responses) | 365 | lock (responses) |
342 | responses[requestID] = response; | 366 | responses[requestID] = response; |
367 | |||
368 | m_module.ProcessedRequestsCount++; | ||
343 | } | 369 | } |
344 | } | 370 | } |
345 | 371 | ||
@@ -363,7 +389,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
363 | capUrl = "/CAPS/" + UUID.Random() + "/"; | 389 | capUrl = "/CAPS/" + UUID.Random() + "/"; |
364 | 390 | ||
365 | // Register this as a poll service | 391 | // Register this as a poll service |
366 | PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, capUrl, agentID); | 392 | PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID); |
367 | args.Type = PollServiceEventArgs.EventType.Inventory; | 393 | args.Type = PollServiceEventArgs.EventType.Inventory; |
368 | 394 | ||
369 | caps.RegisterPollHandler(capName, args); | 395 | caps.RegisterPollHandler(capName, args); |
@@ -372,7 +398,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
372 | else | 398 | else |
373 | { | 399 | { |
374 | capUrl = url; | 400 | capUrl = url; |
375 | IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); | 401 | IExternalCapsModule handler = Scene.RequestModuleInterface<IExternalCapsModule>(); |
376 | if (handler != null) | 402 | if (handler != null) |
377 | handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl); | 403 | handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl); |
378 | else | 404 | else |