aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-12-23 02:17:42 +0000
committerUbitUmarov2016-12-23 02:17:42 +0000
commit2e7e4427d06951e950019b4175f6dba9358c4d0d (patch)
tree553fb176064ac29ae621ed64b0733aafb3120122 /OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
parentAllow the use of modular configs with Robust as we already can with OpenSim (diff)
downloadopensim-SC-2e7e4427d06951e950019b4175f6dba9358c4d0d.zip
opensim-SC-2e7e4427d06951e950019b4175f6dba9358c4d0d.tar.gz
opensim-SC-2e7e4427d06951e950019b4175f6dba9358c4d0d.tar.bz2
opensim-SC-2e7e4427d06951e950019b4175f6dba9358c4d0d.tar.xz
UserProfileModule threading issues
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs140
1 files changed, 77 insertions, 63 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 1ea1306..d232d82 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -438,12 +438,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
438 } 438 }
439 } 439 }
440 440
441 if(uce == null) 441 lock(m_profilesCache)
442 uce = new UserProfileCacheEntry(); 442 {
443 uce.classifiedsLists = classifieds; 443 if(!m_profilesCache.TryGetValue(targetID, out uce) || uce == null)
444 uce = new UserProfileCacheEntry();
445 uce.classifiedsLists = classifieds;
444 446
445 lock(m_profilesCache)
446 m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); 447 m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE);
448 }
447 449
448 remoteClient.SendAvatarClassifiedReply(targetID, classifieds); 450 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
449 } 451 }
@@ -512,14 +514,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
512 if(foreign) 514 if(foreign)
513 cacheForeignImage(target, ad.SnapshotId); 515 cacheForeignImage(target, ad.SnapshotId);
514 516
515 if(uce == null)
516 uce = new UserProfileCacheEntry();
517 if(uce.classifieds == null)
518 uce.classifieds = new Dictionary<UUID, UserClassifiedAdd>();
519 uce.classifieds[ad.ClassifiedId] = ad;
520
521 lock(m_profilesCache) 517 lock(m_profilesCache)
522 m_profilesCache.AddOrUpdate(ad.ClassifiedId, uce, PROFILECACHEEXPIRE); 518 {
519 if(!m_profilesCache.TryGetValue(target, out uce) || uce == null)
520 uce = new UserProfileCacheEntry();
521 if(uce.classifieds == null)
522 uce.classifieds = new Dictionary<UUID, UserClassifiedAdd>();
523 uce.classifieds[ad.ClassifiedId] = ad;
524
525 m_profilesCache.AddOrUpdate(target, uce, PROFILECACHEEXPIRE);
526 }
523 527
524 Vector3 globalPos = new Vector3(); 528 Vector3 globalPos = new Vector3();
525 Vector3.TryParse(ad.GlobalPos, out globalPos); 529 Vector3.TryParse(ad.GlobalPos, out globalPos);
@@ -659,7 +663,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
659 // just flush cache for now 663 // just flush cache for now
660 lock(m_profilesCache) 664 lock(m_profilesCache)
661 { 665 {
662 if(uce != null) 666 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
663 { 667 {
664 uce.classifieds = null; 668 uce.classifieds = null;
665 uce.classifiedsLists = null; 669 uce.classifiedsLists = null;
@@ -679,16 +683,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
679 /// </param> 683 /// </param>
680 public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient) 684 public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
681 { 685 {
682 // just flush cache for now
683 UserProfileCacheEntry uce = null;
684 lock(m_profilesCache)
685 {
686 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
687 {
688 uce.classifieds = null;
689 uce.classifiedsLists = null;
690 }
691 }
692 686
693 string serverURI = string.Empty; 687 string serverURI = string.Empty;
694 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 688 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
@@ -700,6 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
700 remoteClient.SendAgentAlertMessage("Please change classifieds on your home grid", true); 694 remoteClient.SendAgentAlertMessage("Please change classifieds on your home grid", true);
701 return; 695 return;
702 } 696 }
697
703 UUID classifiedId; 698 UUID classifiedId;
704 if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId)) 699 if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId))
705 return; 700 return;
@@ -714,6 +709,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
714 return; 709 return;
715 } 710 }
716 711
712 // flush cache
713 UserProfileCacheEntry uce = null;
714 lock(m_profilesCache)
715 {
716 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
717 {
718 uce.classifieds = null;
719 uce.classifiedsLists = null;
720 }
721 }
722
717 parameters = (OSDMap)Params; 723 parameters = (OSDMap)Params;
718 } 724 }
719 #endregion Classified 725 #endregion Classified
@@ -797,12 +803,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
797 picks[cid] = name; 803 picks[cid] = name;
798 } 804 }
799 805
800 if (uce == null)
801 uce = new UserProfileCacheEntry();
802 uce.picksList = picks;
803
804 lock(m_profilesCache) 806 lock(m_profilesCache)
807 {
808 if(!m_profilesCache.TryGetValue(targetId, out uce) || uce == null)
809 uce = new UserProfileCacheEntry();
810 uce.picksList = picks;
811
805 m_profilesCache.AddOrUpdate(targetId, uce, PROFILECACHEEXPIRE); 812 m_profilesCache.AddOrUpdate(targetId, uce, PROFILECACHEEXPIRE);
813 }
806 814
807 remoteClient.SendAvatarPicksReply(targetId, picks); 815 remoteClient.SendAvatarPicksReply(targetId, picks);
808 } 816 }
@@ -903,14 +911,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
903 m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); 911 m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString());
904 912
905 pick.GlobalPos = globalPos.ToString(); 913 pick.GlobalPos = globalPos.ToString();
906 if (uce == null)
907 uce = new UserProfileCacheEntry();
908 if(uce.picks == null)
909 uce.picks = new Dictionary<UUID, UserProfilePick>();
910 uce.picks[pick.PickId] = pick;
911
912 lock(m_profilesCache) 914 lock(m_profilesCache)
915 {
916 if(!m_profilesCache.TryGetValue(targetID, out uce) || uce == null)
917 uce = new UserProfileCacheEntry();
918 if(uce.picks == null)
919 uce.picks = new Dictionary<UUID, UserProfilePick>();
920 uce.picks[pick.PickId] = pick;
921
913 m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE); 922 m_profilesCache.AddOrUpdate(targetID, uce, PROFILECACHEEXPIRE);
923 }
914 924
915 // Pull the rabbit out of the hat 925 // Pull the rabbit out of the hat
916 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, 926 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
@@ -950,7 +960,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
950 /// </param> 960 /// </param>
951 public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) 961 public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
952 { 962 {
953 //TODO: See how this works with NPC, May need to test
954 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); 963 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
955 964
956 UserProfilePick pick = new UserProfilePick(); 965 UserProfilePick pick = new UserProfilePick();
@@ -1067,11 +1076,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1067 { 1076 {
1068 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) 1077 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1069 { 1078 {
1070 if(uce.picks != null && uce.picks.ContainsKey(queryPickID)) 1079 if(uce.picks != null && uce.picks.ContainsKey(queryPickID))
1071 uce.picks.Remove(queryPickID); 1080 uce.picks.Remove(queryPickID);
1072 if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID)) 1081 if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID))
1073 uce.picksList.Remove(queryPickID); 1082 uce.picksList.Remove(queryPickID);
1074 m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); 1083 m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE);
1075 } 1084 }
1076 } 1085 }
1077 if(uce != null && uce.picksList != null) 1086 if(uce != null && uce.picksList != null)
@@ -1259,15 +1268,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1259 /// </param> 1268 /// </param>
1260 public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages) 1269 public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
1261 { 1270 {
1262 // flush cache for now
1263 UserProfileCacheEntry uce = null;
1264 lock(m_profilesCache)
1265 {
1266 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1267 {
1268 uce.props = null;
1269 }
1270 }
1271 1271
1272 UserProfileProperties prop = new UserProfileProperties(); 1272 UserProfileProperties prop = new UserProfileProperties();
1273 1273
@@ -1290,6 +1290,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1290 "Error updating interests", false); 1290 "Error updating interests", false);
1291 return; 1291 return;
1292 } 1292 }
1293
1294 // flush cache
1295 UserProfileCacheEntry uce = null;
1296 lock(m_profilesCache)
1297 {
1298 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1299 {
1300 uce.props = null;
1301 }
1302 }
1303
1293 } 1304 }
1294 1305
1295 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 1306 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
@@ -1399,15 +1410,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1399 if(!m_allowUserProfileWebURLs) 1410 if(!m_allowUserProfileWebURLs)
1400 props.WebUrl =""; 1411 props.WebUrl ="";
1401 1412
1402 if(uce == null)
1403 uce = new UserProfileCacheEntry();
1404 uce.props = props;
1405 uce.born = born;
1406 uce.membershipType = membershipType;
1407 uce.flags = flags;
1408
1409 lock(m_profilesCache) 1413 lock(m_profilesCache)
1414 {
1415 if(!m_profilesCache.TryGetValue(props.UserId, out uce) || uce == null)
1416 uce = new UserProfileCacheEntry();
1417 uce.props = props;
1418 uce.born = born;
1419 uce.membershipType = membershipType;
1420 uce.flags = flags;
1421
1410 m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE); 1422 m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE);
1423 }
1411 1424
1412 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, 1425 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags,
1413 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); 1426 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
@@ -1429,15 +1442,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1429 { 1442 {
1430 if (remoteClient.AgentId == newProfile.ID) 1443 if (remoteClient.AgentId == newProfile.ID)
1431 { 1444 {
1432 // flush cache for now
1433 UserProfileCacheEntry uce = null;
1434 lock(m_profilesCache)
1435 {
1436 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1437 {
1438 uce.props = null;
1439 }
1440 }
1441 1445
1442 UserProfileProperties prop = new UserProfileProperties(); 1446 UserProfileProperties prop = new UserProfileProperties();
1443 1447
@@ -1463,6 +1467,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1463 return; 1467 return;
1464 } 1468 }
1465 1469
1470 // flush cache
1471 UserProfileCacheEntry uce = null;
1472 lock(m_profilesCache)
1473 {
1474 if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
1475 {
1476 uce.props = null;
1477 }
1478 }
1479
1466 RequestAvatarProperties(remoteClient, newProfile.ID); 1480 RequestAvatarProperties(remoteClient, newProfile.ID);
1467 } 1481 }
1468 } 1482 }