aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs61
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs48
2 files changed, 98 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 37020f6..cc64e6c 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Framework.Communications
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected IUserService m_userService; 43 protected IUserService m_userService;
44 protected Dictionary<LLUUID, string[]> m_nameRequestCache = new Dictionary<LLUUID, string[]>();
44 45
45 public IUserService UserService 46 public IUserService UserService
46 { 47 {
@@ -248,27 +249,69 @@ namespace OpenSim.Framework.Communications
248 } 249 }
249 else 250 else
250 { 251 {
252 string[] names = doUUIDNameRequest(uuid);
253 if (names.Length == 2)
254 {
255 remote_client.SendNameReply(uuid, names[0], names[1]);
256 }
257
258 }
259 }
260
261 private string[] doUUIDNameRequest(LLUUID uuid)
262 {
263 string[] returnstring = new string[0];
264 bool doLookup = false;
265
266
267 lock (m_nameRequestCache)
268 {
269 if (m_nameRequestCache.ContainsKey(uuid))
270 {
271 returnstring = m_nameRequestCache[uuid];
272 }
273 else
274 {
275 // we don't want to lock the dictionary while we're doing the lookup
276 doLookup = true;
277 }
278 }
279
280 if (doLookup) {
251 UserProfileData profileData = m_userService.GetUserProfile(uuid); 281 UserProfileData profileData = m_userService.GetUserProfile(uuid);
252 if (profileData != null) 282 if (profileData != null)
253 { 283 {
284 returnstring = new string[2];
254 LLUUID profileId = profileData.ID; 285 LLUUID profileId = profileData.ID;
255 string firstname = profileData.FirstName; 286 returnstring[0] = profileData.FirstName;
256 string lastname = profileData.SurName; 287 returnstring[1] = profileData.SurName;
257 288 lock (m_nameRequestCache)
258 remote_client.SendNameReply(profileId, firstname, lastname); 289 {
290 if (!m_nameRequestCache.ContainsKey(uuid))
291 m_nameRequestCache.Add(uuid, returnstring);
292 }
259 } 293 }
260 } 294 }
295 return returnstring;
296
261 } 297 }
298
299 public bool UUIDNameCachedTest(LLUUID uuid)
300 {
301 lock (m_nameRequestCache)
302 return m_nameRequestCache.ContainsKey(uuid);
303 }
304
262 public string UUIDNameRequestString(LLUUID uuid) 305 public string UUIDNameRequestString(LLUUID uuid)
263 { 306 {
264 UserProfileData profileData = m_userService.GetUserProfile(uuid); 307 string[] names = doUUIDNameRequest(uuid);
265 if (profileData != null) 308 if (names.Length == 2)
266 { 309 {
267 //LLUUID profileId = profileData.ID; 310 string firstname = names[0];
268 string firstname = profileData.FirstName; 311 string lastname = names[1];
269 string lastname = profileData.SurName;
270 312
271 return firstname + " " + lastname; 313 return firstname + " " + lastname;
314
272 } 315 }
273 return "(hippos)"; 316 return "(hippos)";
274 } 317 }
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index ab5898d..6c63c36 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -24,7 +24,8 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27using System;
28using System.Threading;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using libsecondlife; 31using libsecondlife;
@@ -40,6 +41,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
40 { 41 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 43
44 private delegate void LookupUUIDS(List<LLUUID> uuidLst);
45
43 private Scene m_scene; 46 private Scene m_scene;
44 47
45 #region Packet Data Responders 48 #region Packet Data Responders
@@ -314,6 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
314 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) 317 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
315 { 318 {
316 Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); 319 Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
320 List<LLUUID> uuidNameLookupList = new List<LLUUID>();
317 321
318 if (reportType == 1) 322 if (reportType == 1)
319 { 323 {
@@ -345,7 +349,17 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
345 lsri.TaskID = sog.UUID; 349 lsri.TaskID = sog.UUID;
346 lsri.TaskLocalID = sog.LocalId; 350 lsri.TaskLocalID = sog.LocalId;
347 lsri.TaskName = sog.GetPartName(obj); 351 lsri.TaskName = sog.GetPartName(obj);
348 lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); 352 if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID))
353 {
354 lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
355 }
356 else
357 {
358 lsri.OwnerName = "waiting";
359 lock(uuidNameLookupList)
360 uuidNameLookupList.Add(sog.OwnerID);
361 }
362
349 if (filter.Length != 0) 363 if (filter.Length != 0)
350 { 364 {
351 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) 365 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
@@ -365,9 +379,39 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
365 } 379 }
366 } 380 }
367 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); 381 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
382
383 if (uuidNameLookupList.Count > 0)
384 LookupUUID(uuidNameLookupList);
385 }
386
387 private void LookupUUIDSCompleted(IAsyncResult iar)
388 {
389 LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
390 icon.EndInvoke(iar);
391 }
392 private void LookupUUID(List<LLUUID> uuidLst)
393 {
394 LookupUUIDS d = LookupUUIDsAsync;
368 395
396 d.BeginInvoke(uuidLst,
397 LookupUUIDSCompleted,
398 d);
369 } 399 }
400 private void LookupUUIDsAsync(List<LLUUID> uuidLst)
401 {
402 LLUUID[] uuidarr = new LLUUID[0];
403
404 lock (uuidLst)
405 {
406 uuidarr = uuidLst.ToArray();
407 }
370 408
409 for (int i = 0; i < uuidarr.Length; i++)
410 {
411 string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
412 // we drop it. It gets cached though... so we're ready for the next request.
413 }
414 }
371 #endregion 415 #endregion
372 416
373 #region Outgoing Packets 417 #region Outgoing Packets