aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorMelanie2013-07-13 00:47:58 +0100
committerMelanie2013-07-13 00:47:58 +0100
commita53a10ad270ea02e57aca7787d0b8278989eea68 (patch)
tree7ff1b6d170e828e8b9628ef13078b2cd0ecbd8b6 /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' into careminster (diff)
parentCentralize duplicated code in SceneObjectPart for subscribing to (diff)
downloadopensim-SC-a53a10ad270ea02e57aca7787d0b8278989eea68.zip
opensim-SC-a53a10ad270ea02e57aca7787d0b8278989eea68.tar.gz
opensim-SC-a53a10ad270ea02e57aca7787d0b8278989eea68.tar.bz2
opensim-SC-a53a10ad270ea02e57aca7787d0b8278989eea68.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs337
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs163
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs71
7 files changed, 529 insertions, 56 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index fff86d5..2fc3b1c 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using log4net; 34using log4net;
@@ -37,6 +38,7 @@ using OpenMetaverse;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
39using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using Caps=OpenSim.Framework.Capabilities.Caps; 44using Caps=OpenSim.Framework.Capabilities.Caps;
@@ -57,8 +59,9 @@ namespace OpenSim.Region.CoreModules.Framework
57 /// </summary> 59 /// </summary>
58 protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>(); 60 protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>();
59 61
60 protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); 62 protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
61 protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds 63
64 protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
62 = new Dictionary<UUID, Dictionary<ulong, string>>(); 65 = new Dictionary<UUID, Dictionary<ulong, string>>();
63 66
64 public void Initialise(IConfigSource source) 67 public void Initialise(IConfigSource source)
@@ -70,9 +73,24 @@ namespace OpenSim.Region.CoreModules.Framework
70 m_scene = scene; 73 m_scene = scene;
71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); 74 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
72 75
73 MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps", 76 MainConsole.Instance.Commands.AddCommand(
74 "show caps", 77 "Comms", false, "show caps list",
75 "Shows all registered capabilities for users", HandleShowCapsCommand); 78 "show caps list",
79 "Shows list of registered capabilities for users.", HandleShowCapsListCommand);
80
81 MainConsole.Instance.Commands.AddCommand(
82 "Comms", false, "show caps stats by user",
83 "show caps stats [<first-name> <last-name>]",
84 "Shows statistics on capabilities use by user.",
85 "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.",
86 HandleShowCapsStatsByUserCommand);
87
88 MainConsole.Instance.Commands.AddCommand(
89 "Comms", false, "show caps stats by cap",
90 "show caps stats by cap [<cap-name>]",
91 "Shows statistics on capabilities use by capability.",
92 "If a capability name is given, then prints a detailed breakdown of use by each user.",
93 HandleShowCapsStatsByCapCommand);
76 } 94 }
77 95
78 public void RegionLoaded(Scene scene) 96 public void RegionLoaded(Scene scene)
@@ -106,6 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework
106 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) 124 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
107 return; 125 return;
108 126
127 Caps caps;
109 String capsObjectPath = GetCapsPath(agentId); 128 String capsObjectPath = GetCapsPath(agentId);
110 129
111 if (m_capsObjects.ContainsKey(circuitCode)) 130 if (m_capsObjects.ContainsKey(circuitCode))
@@ -121,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Framework
121 //return; 140 //return;
122 } 141 }
123 142
124 Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, 143 caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
125 (MainServer.Instance == null) ? 0: MainServer.Instance.Port, 144 (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
126 capsObjectPath, agentId, m_scene.RegionInfo.RegionName); 145 capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
127 146
@@ -132,9 +151,12 @@ namespace OpenSim.Region.CoreModules.Framework
132 151
133 public void RemoveCaps(UUID agentId, uint circuitCode) 152 public void RemoveCaps(UUID agentId, uint circuitCode)
134 { 153 {
135 if (childrenSeeds.ContainsKey(agentId)) 154 lock (m_childrenSeeds)
136 { 155 {
137 childrenSeeds.Remove(agentId); 156 if (m_childrenSeeds.ContainsKey(agentId))
157 {
158 m_childrenSeeds.Remove(agentId);
159 }
138 } 160 }
139 161
140 lock (m_capsObjects) 162 lock (m_capsObjects)
@@ -180,16 +202,22 @@ namespace OpenSim.Region.CoreModules.Framework
180 202
181 public void SetAgentCapsSeeds(AgentCircuitData agent) 203 public void SetAgentCapsSeeds(AgentCircuitData agent)
182 { 204 {
183 capsPaths[agent.AgentID] = agent.CapsPath; 205 lock (m_capsPaths)
184 childrenSeeds[agent.AgentID] 206 m_capsPaths[agent.AgentID] = agent.CapsPath;
185 = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds); 207
208 lock (m_childrenSeeds)
209 m_childrenSeeds[agent.AgentID]
210 = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
186 } 211 }
187 212
188 public string GetCapsPath(UUID agentId) 213 public string GetCapsPath(UUID agentId)
189 { 214 {
190 if (capsPaths.ContainsKey(agentId)) 215 lock (m_capsPaths)
191 { 216 {
192 return capsPaths[agentId]; 217 if (m_capsPaths.ContainsKey(agentId))
218 {
219 return m_capsPaths[agentId];
220 }
193 } 221 }
194 222
195 return null; 223 return null;
@@ -198,17 +226,24 @@ namespace OpenSim.Region.CoreModules.Framework
198 public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID) 226 public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
199 { 227 {
200 Dictionary<ulong, string> seeds = null; 228 Dictionary<ulong, string> seeds = null;
201 if (childrenSeeds.TryGetValue(agentID, out seeds)) 229
202 return seeds; 230 lock (m_childrenSeeds)
231 if (m_childrenSeeds.TryGetValue(agentID, out seeds))
232 return seeds;
233
203 return new Dictionary<ulong, string>(); 234 return new Dictionary<ulong, string>();
204 } 235 }
205 236
206 public void DropChildSeed(UUID agentID, ulong handle) 237 public void DropChildSeed(UUID agentID, ulong handle)
207 { 238 {
208 Dictionary<ulong, string> seeds; 239 Dictionary<ulong, string> seeds;
209 if (childrenSeeds.TryGetValue(agentID, out seeds)) 240
241 lock (m_childrenSeeds)
210 { 242 {
211 seeds.Remove(handle); 243 if (m_childrenSeeds.TryGetValue(agentID, out seeds))
244 {
245 seeds.Remove(handle);
246 }
212 } 247 }
213 } 248 }
214 249
@@ -216,53 +251,283 @@ namespace OpenSim.Region.CoreModules.Framework
216 { 251 {
217 Dictionary<ulong, string> seeds; 252 Dictionary<ulong, string> seeds;
218 string returnval; 253 string returnval;
219 if (childrenSeeds.TryGetValue(agentID, out seeds)) 254
255 lock (m_childrenSeeds)
220 { 256 {
221 if (seeds.TryGetValue(handle, out returnval)) 257 if (m_childrenSeeds.TryGetValue(agentID, out seeds))
222 return returnval; 258 {
259 if (seeds.TryGetValue(handle, out returnval))
260 return returnval;
261 }
223 } 262 }
263
224 return null; 264 return null;
225 } 265 }
226 266
227 public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds) 267 public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
228 { 268 {
229 //m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count); 269 //m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
230 childrenSeeds[agentID] = seeds; 270
271 lock (m_childrenSeeds)
272 m_childrenSeeds[agentID] = seeds;
231 } 273 }
232 274
233 public void DumpChildrenSeeds(UUID agentID) 275 public void DumpChildrenSeeds(UUID agentID)
234 { 276 {
235 m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================"); 277 m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
236 foreach (KeyValuePair<ulong, string> kvp in childrenSeeds[agentID]) 278
279 lock (m_childrenSeeds)
237 { 280 {
238 uint x, y; 281 foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
239 Utils.LongToUInts(kvp.Key, out x, out y); 282 {
240 x = x / Constants.RegionSize; 283 uint x, y;
241 y = y / Constants.RegionSize; 284 Utils.LongToUInts(kvp.Key, out x, out y);
242 m_log.Info(" >> "+x+", "+y+": "+kvp.Value); 285 x = x / Constants.RegionSize;
286 y = y / Constants.RegionSize;
287 m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
288 }
243 } 289 }
244 } 290 }
245 291
246 private void HandleShowCapsCommand(string module, string[] cmdparams) 292 private void HandleShowCapsListCommand(string module, string[] cmdParams)
247 { 293 {
294 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
295 return;
296
248 StringBuilder caps = new StringBuilder(); 297 StringBuilder caps = new StringBuilder();
249 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); 298 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
250 299
251 foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects) 300 lock (m_capsObjects)
252 { 301 {
253 caps.AppendFormat("** Circuit {0}:\n", kvp.Key); 302 foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
303 {
304 caps.AppendFormat("** User {0}:\n", kvp.Key);
254 305
255 for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); ) 306 for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
307 {
308 Uri uri = new Uri(kvp2.Value.ToString());
309 caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
310 }
311
312 foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
313 caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
314 }
315 }
316
317 MainConsole.Instance.Output(caps.ToString());
318 }
319
320 private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams)
321 {
322 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
323 return;
324
325 if (cmdParams.Length != 5 && cmdParams.Length != 6)
326 {
327 MainConsole.Instance.Output("Usage: show caps stats by cap [<cap-name>]");
328 return;
329 }
330
331 StringBuilder sb = new StringBuilder();
332 sb.AppendFormat("Region {0}:\n", m_scene.Name);
333
334 if (cmdParams.Length == 5)
335 {
336 BuildSummaryStatsByCapReport(sb);
337 }
338 else if (cmdParams.Length == 6)
339 {
340 BuildDetailedStatsByCapReport(sb, cmdParams[5]);
341 }
342
343 MainConsole.Instance.Output(sb.ToString());
344 }
345
346 private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
347 {
348 /*
349 sb.AppendFormat("Capability name {0}\n", capName);
350
351 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
352 cdt.AddColumn("User Name", 34);
353 cdt.AddColumn("Req Received", 12);
354 cdt.AddColumn("Req Handled", 12);
355 cdt.Indent = 2;
356
357 Dictionary<string, int> receivedStats = new Dictionary<string, int>();
358 Dictionary<string, int> handledStats = new Dictionary<string, int>();
359
360 m_scene.ForEachScenePresence(
361 sp =>
256 { 362 {
257 Uri uri = new Uri(kvp2.Value.ToString()); 363 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
258 caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); 364
365 if (caps == null)
366 return;
367
368 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
369
370 IRequestHandler reqHandler;
371 if (capsHandlers.TryGetValue(capName, out reqHandler))
372 {
373 receivedStats[sp.Name] = reqHandler.RequestsReceived;
374 handledStats[sp.Name] = reqHandler.RequestsHandled;
375 }
259 } 376 }
377 );
260 378
261 foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers) 379 foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
262 caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); 380 {
381 cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
263 } 382 }
264 383
265 MainConsole.Instance.Output(caps.ToString()); 384 sb.Append(cdt.ToString());
385 */
386 }
387
388 private void BuildSummaryStatsByCapReport(StringBuilder sb)
389 {
390 /*
391 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
392 cdt.AddColumn("Name", 34);
393 cdt.AddColumn("Req Received", 12);
394 cdt.AddColumn("Req Handled", 12);
395 cdt.Indent = 2;
396
397 Dictionary<string, int> receivedStats = new Dictionary<string, int>();
398 Dictionary<string, int> handledStats = new Dictionary<string, int>();
399
400 m_scene.ForEachScenePresence(
401 sp =>
402 {
403 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
404
405 if (caps == null)
406 return;
407
408 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
409
410 foreach (IRequestHandler reqHandler in capsHandlers.Values)
411 {
412 string reqName = reqHandler.Name ?? "";
413
414 if (!receivedStats.ContainsKey(reqName))
415 {
416 receivedStats[reqName] = reqHandler.RequestsReceived;
417 handledStats[reqName] = reqHandler.RequestsHandled;
418 }
419 else
420 {
421 receivedStats[reqName] += reqHandler.RequestsReceived;
422 handledStats[reqName] += reqHandler.RequestsHandled;
423 }
424 }
425 }
426 );
427
428 foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
429 cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
430
431 sb.Append(cdt.ToString());
432 */
433 }
434
435 private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
436 {
437 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
438 return;
439
440 if (cmdParams.Length != 5 && cmdParams.Length != 7)
441 {
442 MainConsole.Instance.Output("Usage: show caps stats by user [<first-name> <last-name>]");
443 return;
444 }
445
446 StringBuilder sb = new StringBuilder();
447 sb.AppendFormat("Region {0}:\n", m_scene.Name);
448
449 if (cmdParams.Length == 5)
450 {
451 BuildSummaryStatsByUserReport(sb);
452 }
453 else if (cmdParams.Length == 7)
454 {
455 string firstName = cmdParams[5];
456 string lastName = cmdParams[6];
457
458 ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
459
460 if (sp == null)
461 return;
462
463 BuildDetailedStatsByUserReport(sb, sp);
464 }
465
466 MainConsole.Instance.Output(sb.ToString());
467 }
468
469 private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
470 {
471 /*
472 sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
473
474 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
475 cdt.AddColumn("Cap Name", 34);
476 cdt.AddColumn("Req Received", 12);
477 cdt.AddColumn("Req Handled", 12);
478 cdt.Indent = 2;
479
480 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
481
482 if (caps == null)
483 return;
484
485 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
486
487 foreach (IRequestHandler reqHandler in capsHandlers.Values.OrderByDescending(rh => rh.RequestsReceived))
488 {
489 cdt.AddRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled);
490 }
491
492 sb.Append(cdt.ToString());
493 */
494 }
495
496 private void BuildSummaryStatsByUserReport(StringBuilder sb)
497 {
498 /*
499 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
500 cdt.AddColumn("Name", 32);
501 cdt.AddColumn("Type", 5);
502 cdt.AddColumn("Req Received", 12);
503 cdt.AddColumn("Req Handled", 12);
504 cdt.Indent = 2;
505
506 m_scene.ForEachScenePresence(
507 sp =>
508 {
509 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
510
511 if (caps == null)
512 return;
513
514 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
515
516 int totalRequestsReceived = 0;
517 int totalRequestsHandled = 0;
518
519 foreach (IRequestHandler reqHandler in capsHandlers.Values)
520 {
521 totalRequestsReceived += reqHandler.RequestsReceived;
522 totalRequestsHandled += reqHandler.RequestsHandled;
523 }
524
525 cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
526 }
527 );
528
529 sb.Append(cdt.ToString());
530 */
266 } 531 }
267 } 532 }
268} 533}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 73b3678f..975fccf 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -171,11 +171,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
171 if (!so.IsAttachment) 171 if (!so.IsAttachment)
172 return; 172 return;
173 173
174 if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) 174 if (so.AttachedAvatar == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar))
175 return; 175 return;
176 176
177 // foreign user 177 // foreign user
178 AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); 178 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
179 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 179 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
180 { 180 {
181 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) 181 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
@@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
183 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); 183 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
184 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); 184 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
185 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 185 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
186 HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url); 186 HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url);
187 uuidGatherer.GatherAssetUuids(so, ids); 187 uuidGatherer.GatherAssetUuids(so, ids);
188 188
189 foreach (KeyValuePair<UUID, AssetType> kvp in ids) 189 foreach (KeyValuePair<UUID, AssetType> kvp in ids)
diff --git a/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
new file mode 100644
index 0000000..f1eb1ad
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
@@ -0,0 +1,163 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using log4net;
33using Mono.Addins;
34using Nini.Config;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Framework.Monitoring;
39using OpenSim.Region.Framework.Scenes;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41
42namespace OpenSim.Region.CoreModules.Framework
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GridServiceThrottleModule")]
45 public class GridServiceThrottleModule : ISharedRegionModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 private readonly List<Scene> m_scenes = new List<Scene>();
51
52 private OpenSim.Framework.BlockingQueue<GridRegionRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<GridRegionRequest>();
53
54 public void Initialise(IConfigSource config)
55 {
56 Watchdog.StartThread(
57 ProcessQueue,
58 "GridServiceRequestThread",
59 ThreadPriority.BelowNormal,
60 true,
61 false);
62 }
63
64 public void AddRegion(Scene scene)
65 {
66 lock (m_scenes)
67 {
68 m_scenes.Add(scene);
69 scene.EventManager.OnNewClient += OnNewClient;
70 }
71 }
72
73 public void RegionLoaded(Scene scene)
74 {
75 }
76
77 public void RemoveRegion(Scene scene)
78 {
79 lock (m_scenes)
80 {
81 m_scenes.Remove(scene);
82 scene.EventManager.OnNewClient -= OnNewClient;
83 }
84 }
85
86 void OnNewClient(IClientAPI client)
87 {
88 client.OnRegionHandleRequest += OnRegionHandleRequest;
89 }
90
91 public void PostInitialise()
92 {
93 }
94
95 public void Close()
96 {
97 }
98
99 public string Name
100 {
101 get { return "GridServiceThrottleModule"; }
102 }
103
104 public Type ReplaceableInterface
105 {
106 get { return null; }
107 }
108
109 public void OnRegionHandleRequest(IClientAPI client, UUID regionID)
110 {
111 //m_log.DebugFormat("[GRIDSERVICE THROTTLE]: RegionHandleRequest {0}", regionID);
112 ulong handle = 0;
113 if (IsLocalRegionHandle(regionID, out handle))
114 {
115 client.SendRegionHandle(regionID, handle);
116 return;
117 }
118
119 GridRegionRequest request = new GridRegionRequest(client, regionID);
120 m_RequestQueue.Enqueue(request);
121
122 }
123
124 private bool IsLocalRegionHandle(UUID regionID, out ulong regionHandle)
125 {
126 regionHandle = 0;
127 foreach (Scene s in m_scenes)
128 if (s.RegionInfo.RegionID == regionID)
129 {
130 regionHandle = s.RegionInfo.RegionHandle;
131 return true;
132 }
133 return false;
134 }
135
136 private void ProcessQueue()
137 {
138 while (true)
139 {
140 Watchdog.UpdateThread();
141
142 GridRegionRequest request = m_RequestQueue.Dequeue();
143 GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, request.regionID);
144
145 if (r != null && r.RegionHandle != 0)
146 request.client.SendRegionHandle(request.regionID, r.RegionHandle);
147
148 }
149 }
150 }
151
152 class GridRegionRequest
153 {
154 public IClientAPI client;
155 public UUID regionID;
156
157 public GridRegionRequest(IClientAPI c, UUID r)
158 {
159 client = c;
160 regionID = r;
161 }
162 }
163}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 1eae0ac..e0c8ea6 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
135 if (sp is ScenePresence) 135 if (sp is ScenePresence)
136 { 136 {
137 AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); 137 AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
138 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 138 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
139 { 139 {
140 if (m_RestrictInventoryAccessAbroad) 140 if (m_RestrictInventoryAccessAbroad)
141 { 141 {
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index d07cff4..69d7e16 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
176 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); 176 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
177 simpleName = GetInventoryPathFromName(simpleName); 177 simpleName = GetInventoryPathFromName(simpleName);
178 178
179 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName, false); 179 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false);
180 try 180 try
181 { 181 {
182 HashSet<InventoryNodeBase> nodes = archread.Execute(); 182 HashSet<InventoryNodeBase> nodes = archread.Execute();
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
185 // didn't find the subfolder with the given name; place it on the top 185 // didn't find the subfolder with the given name; place it on the top
186 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); 186 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
187 archread.Close(); 187 archread.Close();
188 archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false); 188 archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false);
189 archread.Execute(); 189 archread.Execute();
190 } 190 }
191 191
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index ad3cf15..245c808 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
58 if (umanmod == Name) 58 if (umanmod == Name)
59 { 59 {
60 m_Enabled = true; 60 m_Enabled = true;
61 RegisterConsoleCmds(); 61 Init();
62 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); 62 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
63 } 63 }
64 } 64 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a7cbc8f..a528093 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -28,9 +28,11 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.IO; 29using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Threading;
31 32
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Monitoring;
34using OpenSim.Region.ClientStack.LindenUDP; 36using OpenSim.Region.ClientStack.LindenUDP;
35using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
36using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
@@ -57,6 +59,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
57 // The cache 59 // The cache
58 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); 60 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
59 61
62 // Throttle the name requests
63 private OpenSim.Framework.BlockingQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<NameRequest>();
64
65
60 #region ISharedRegionModule 66 #region ISharedRegionModule
61 67
62 public void Initialise(IConfigSource config) 68 public void Initialise(IConfigSource config)
@@ -65,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
65 if (umanmod == Name) 71 if (umanmod == Name)
66 { 72 {
67 m_Enabled = true; 73 m_Enabled = true;
68 RegisterConsoleCmds(); 74 Init();
69 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); 75 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
70 } 76 }
71 } 77 }
@@ -160,16 +166,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
160 } 166 }
161 else 167 else
162 { 168 {
163 string[] names; 169 NameRequest request = new NameRequest(remote_client, uuid);
164 bool foundRealName = TryGetUserNames(uuid, out names); 170 m_RequestQueue.Enqueue(request);
165 171
166 if (names.Length == 2)
167 {
168 if (!foundRealName)
169 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], uuid, remote_client.Name);
170
171 remote_client.SendNameReply(uuid, names[0], names[1]);
172 }
173 } 172 }
174 } 173 }
175 174
@@ -514,9 +513,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
514 return; 513 return;
515 } 514 }
516 515
517 //try update unknown users 516 //try update unknown users, but don't update anyone else
518 //and creator's home URL's 517 if (oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown"))
519 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
520 { 518 {
521 lock (m_UserCache) 519 lock (m_UserCache)
522 m_UserCache.Remove(id); 520 m_UserCache.Remove(id);
@@ -597,6 +595,18 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
597 595
598 #endregion IUserManagement 596 #endregion IUserManagement
599 597
598 protected void Init()
599 {
600 RegisterConsoleCmds();
601 Watchdog.StartThread(
602 ProcessQueue,
603 "NameRequestThread",
604 ThreadPriority.BelowNormal,
605 true,
606 false);
607
608 }
609
600 protected void RegisterConsoleCmds() 610 protected void RegisterConsoleCmds()
601 { 611 {
602 MainConsole.Instance.Commands.AddCommand("Users", true, 612 MainConsole.Instance.Commands.AddCommand("Users", true,
@@ -663,5 +673,40 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
663 673
664 MainConsole.Instance.Output(cdt.ToString()); 674 MainConsole.Instance.Output(cdt.ToString());
665 } 675 }
676
677 private void ProcessQueue()
678 {
679 while (true)
680 {
681 Watchdog.UpdateThread();
682
683 NameRequest request = m_RequestQueue.Dequeue();
684 string[] names;
685 bool foundRealName = TryGetUserNames(request.uuid, out names);
686
687 if (names.Length == 2)
688 {
689 if (!foundRealName)
690 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name);
691
692 request.client.SendNameReply(request.uuid, names[0], names[1]);
693 }
694
695 }
696 }
697
698 }
699
700 class NameRequest
701 {
702 public IClientAPI client;
703 public UUID uuid;
704
705 public NameRequest(IClientAPI c, UUID n)
706 {
707 client = c;
708 uuid = n;
709 }
666 } 710 }
711
667} \ No newline at end of file 712} \ No newline at end of file