diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 66 |
2 files changed, 57 insertions, 11 deletions
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 524d159..a528093 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -28,9 +28,11 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | ||
31 | 32 | ||
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Monitoring; | ||
34 | using OpenSim.Region.ClientStack.LindenUDP; | 36 | using OpenSim.Region.ClientStack.LindenUDP; |
35 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 38 | using 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 | ||
@@ -596,6 +595,18 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
596 | 595 | ||
597 | #endregion IUserManagement | 596 | #endregion IUserManagement |
598 | 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 | |||
599 | protected void RegisterConsoleCmds() | 610 | protected void RegisterConsoleCmds() |
600 | { | 611 | { |
601 | MainConsole.Instance.Commands.AddCommand("Users", true, | 612 | MainConsole.Instance.Commands.AddCommand("Users", true, |
@@ -662,5 +673,40 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
662 | 673 | ||
663 | MainConsole.Instance.Output(cdt.ToString()); | 674 | MainConsole.Instance.Output(cdt.ToString()); |
664 | } | 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 | } | ||
665 | } | 710 | } |
711 | |||
666 | } \ No newline at end of file | 712 | } \ No newline at end of file |